Compare commits
9 Commits
0ab7da3ff0
..
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 4018e31455 | |||
| b266c561f1 | |||
| b44c9abf8e | |||
| 273de51797 | |||
| 5a3510873b | |||
| 8aa8895c52 | |||
| 9fc1ea35e8 | |||
| f6af1add93 | |||
| 5d10610a1d |
@@ -5,3 +5,8 @@ Adds redstone-like dust for glowstone.
|
|||||||
- Can be customized to look a little more stylized
|
- Can be customized to look a little more stylized
|
||||||
|
|
||||||
10/10, great mod.
|
10/10, great mod.
|
||||||
|
|
||||||
|
===================
|
||||||
|
|
||||||
|
This mod will not see any further updates,
|
||||||
|
And I urge you to look at Wired Dust by myself.
|
||||||
+4
-1
@@ -16,6 +16,7 @@ repositories {
|
|||||||
// Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
|
// Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
|
||||||
// See https://docs.gradle.org/current/userguide/declaring_repositories.html
|
// See https://docs.gradle.org/current/userguide/declaring_repositories.html
|
||||||
// for more information about repositories.
|
// for more information about repositories.
|
||||||
|
maven{url "https://maven.shedaniel.me/"}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
@@ -28,7 +29,9 @@ dependencies {
|
|||||||
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
|
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
|
||||||
|
|
||||||
// Custom API's
|
// Custom API's
|
||||||
implementation "me.zeroeightsix:fiber:${project.fiber_version}"
|
modApi ("me.shedaniel.cloth:cloth-config-fabric:4.11.26") {
|
||||||
|
exclude(group: "net.fabricmc.fabric-api")
|
||||||
|
}
|
||||||
|
|
||||||
// PSA: Some older mods, compiled on Loom 0.2.1, might have outdated Maven POMs.
|
// PSA: Some older mods, compiled on Loom 0.2.1, might have outdated Maven POMs.
|
||||||
// You may need to force-disable transitiveness on them.
|
// You may need to force-disable transitiveness on them.
|
||||||
|
|||||||
+1
-2
@@ -8,11 +8,10 @@ org.gradle.jvmargs=-Xmx1G
|
|||||||
loader_version=0.11.3
|
loader_version=0.11.3
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version = 0.0.1
|
mod_version = 1.0.0
|
||||||
maven_group = me.parsell
|
maven_group = me.parsell
|
||||||
archives_base_name = glowstonewire
|
archives_base_name = glowstonewire
|
||||||
|
|
||||||
# Dependencies
|
# Dependencies
|
||||||
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
|
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
|
||||||
fabric_version=0.32.5+1.16
|
fabric_version=0.32.5+1.16
|
||||||
fiber_version =0.23.0-2
|
|
||||||
|
|||||||
@@ -2,14 +2,24 @@ package me.parsell.glowstonewire;
|
|||||||
|
|
||||||
import me.parsell.glowstonewire.core.glowBlocks;
|
import me.parsell.glowstonewire.core.glowBlocks;
|
||||||
import me.parsell.glowstonewire.core.glowItems;
|
import me.parsell.glowstonewire.core.glowItems;
|
||||||
|
import me.parsell.glowstonewire.core.glowLootTables;
|
||||||
|
import me.parsell.glowstonewire.core.glowRecipes;
|
||||||
|
import me.shedaniel.autoconfig.AutoConfig;
|
||||||
|
import me.shedaniel.autoconfig.serializer.GsonConfigSerializer;
|
||||||
import net.fabricmc.api.ModInitializer;
|
import net.fabricmc.api.ModInitializer;
|
||||||
|
|
||||||
public class GlowstoneWire implements ModInitializer {
|
public class GlowstoneWire implements ModInitializer {
|
||||||
public static final String MODID = "glowstonewire";
|
public static final String MODID = "glowstonewire";
|
||||||
|
public static GlowstoneWireConfig CONFIG;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onInitialize() {
|
public void onInitialize() {
|
||||||
|
AutoConfig.register(GlowstoneWireConfig.class, GsonConfigSerializer::new);
|
||||||
|
CONFIG = AutoConfig.getConfigHolder(GlowstoneWireConfig.class).getConfig();
|
||||||
|
|
||||||
glowBlocks.init();
|
glowBlocks.init();
|
||||||
glowItems.init();
|
glowItems.init();
|
||||||
|
glowRecipes.init();
|
||||||
|
glowLootTables.init();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package me.parsell.glowstonewire;
|
||||||
|
|
||||||
|
import me.shedaniel.autoconfig.ConfigData;
|
||||||
|
import me.shedaniel.autoconfig.annotation.Config;
|
||||||
|
|
||||||
|
@Config(name = "GlowstoneWire")
|
||||||
|
public class GlowstoneWireConfig implements ConfigData{
|
||||||
|
public String Description = "Changing this does nothing. Replacing glowstone drops is dirty, and will overwrite ALL loot tables that attempt to change minecraft's glowstone loot table. Disable this, and cocnsider using a datapack to achieve what you want.";
|
||||||
|
public boolean addConversionRecipes = true;
|
||||||
|
public boolean replaceGlowstoneDrop = true;
|
||||||
|
}
|
||||||
@@ -70,9 +70,9 @@ public class GlowstoneWireBlock extends Block{
|
|||||||
|
|
||||||
private static boolean hasConnection(BlockState state) {
|
private static boolean hasConnection(BlockState state) {
|
||||||
return ((GlowWireConnection)state.get(WIRE_CONNECTION_NORTH)).isConnected() ||
|
return ((GlowWireConnection)state.get(WIRE_CONNECTION_NORTH)).isConnected() ||
|
||||||
((GlowWireConnection)state.get(WIRE_CONNECTION_SOUTH)).isConnected() ||
|
((GlowWireConnection)state.get(WIRE_CONNECTION_SOUTH)).isConnected() ||
|
||||||
((GlowWireConnection)state.get(WIRE_CONNECTION_EAST)).isConnected() ||
|
((GlowWireConnection)state.get(WIRE_CONNECTION_EAST)).isConnected() ||
|
||||||
((GlowWireConnection)state.get(WIRE_CONNECTION_WEST)).isConnected();
|
((GlowWireConnection)state.get(WIRE_CONNECTION_WEST)).isConnected();
|
||||||
}
|
}
|
||||||
|
|
||||||
private BlockState determineState(WorldAccess world, BlockState state, BlockPos pos){
|
private BlockState determineState(WorldAccess world, BlockState state, BlockPos pos){
|
||||||
@@ -85,17 +85,18 @@ public class GlowstoneWireBlock extends Block{
|
|||||||
}
|
}
|
||||||
|
|
||||||
private GlowWireConnection determineConnection(WorldAccess world, BlockPos pos, Direction direction){
|
private GlowWireConnection determineConnection(WorldAccess world, BlockPos pos, Direction direction){
|
||||||
if((world.getBlockState(pos.offset(direction).up()).isOf(this) && world.isAir(pos.up()))) // If offset+up is me && if up is air
|
BlockPos offsetPos = pos.offset(direction);
|
||||||
if(!world.getBlockState(pos.offset(direction).up()).get(DIRECTION_TO_WIRE_CONNECTION.get(direction.getOpposite())).isBroken()) //if offset+up is not broken
|
if((world.getBlockState(offsetPos.up()).isOf(this) && world.isAir(pos.up()))) // If offset+up is me && if up is air
|
||||||
if(world.getBlockState(pos.offset(direction)).hasSidedTransparency())
|
if(!world.getBlockState(offsetPos.up()).get(DIRECTION_TO_WIRE_CONNECTION.get(direction.getOpposite())).isBroken()) //if offset+up is not broken
|
||||||
|
if(world.getBlockState(offsetPos).hasSidedTransparency())
|
||||||
return GlowWireConnection.SIDE;
|
return GlowWireConnection.SIDE;
|
||||||
else
|
else
|
||||||
return GlowWireConnection.UP;
|
return GlowWireConnection.UP;
|
||||||
if(world.getBlockState(pos.offset(direction).down()).isOf(this) && world.isAir(pos.offset(direction))) // if offset+down is me && if offset is air
|
if(world.getBlockState(offsetPos.down()).isOf(this) && world.isAir(offsetPos)) // if offset+down is me && if offset is air
|
||||||
if(!world.getBlockState(pos.offset(direction).down()).get(DIRECTION_TO_WIRE_CONNECTION.get(direction.getOpposite())).isBroken()) //if offset+down is not broken
|
if(!world.getBlockState(offsetPos.down()).get(DIRECTION_TO_WIRE_CONNECTION.get(direction.getOpposite())).isBroken()) //if offset+down is not broken
|
||||||
return GlowWireConnection.SIDE;
|
return GlowWireConnection.SIDE;
|
||||||
if(world.getBlockState(pos.offset(direction)).isOf(this)) // if offset is me
|
if(world.getBlockState(offsetPos).isOf(this)) // if offset is me
|
||||||
if(!world.getBlockState(pos.offset(direction)).get(DIRECTION_TO_WIRE_CONNECTION.get(direction.getOpposite())).isBroken()) // if offset is not broken
|
if(!world.getBlockState(offsetPos).get(DIRECTION_TO_WIRE_CONNECTION.get(direction.getOpposite())).isBroken()) // if offset is not broken
|
||||||
return GlowWireConnection.SIDE;
|
return GlowWireConnection.SIDE;
|
||||||
return GlowWireConnection.NONE;
|
return GlowWireConnection.NONE;
|
||||||
}
|
}
|
||||||
@@ -108,9 +109,9 @@ public class GlowstoneWireBlock extends Block{
|
|||||||
public VoxelShape determineVoxelShape(BlockState state){
|
public VoxelShape determineVoxelShape(BlockState state){
|
||||||
VoxelShape voxelShape = DOT_VOXELSHAPE;
|
VoxelShape voxelShape = DOT_VOXELSHAPE;
|
||||||
|
|
||||||
Iterator dirItr1 = Direction.Type.HORIZONTAL.iterator();
|
Iterator dirItr = Direction.Type.HORIZONTAL.iterator();
|
||||||
while(dirItr1.hasNext()) {
|
while(dirItr.hasNext()) {
|
||||||
Direction direction = (Direction)dirItr1.next();
|
Direction direction = (Direction)dirItr.next();
|
||||||
GlowWireConnection wireConnection = state.get(DIRECTION_TO_WIRE_CONNECTION.get(direction));
|
GlowWireConnection wireConnection = state.get(DIRECTION_TO_WIRE_CONNECTION.get(direction));
|
||||||
if(state.equals(this.getDefaultState().with(DIRECTION_TO_WIRE_CONNECTION.get(direction), GlowWireConnection.SIDE))) {
|
if(state.equals(this.getDefaultState().with(DIRECTION_TO_WIRE_CONNECTION.get(direction), GlowWireConnection.SIDE))) {
|
||||||
voxelShape = VoxelShapes.union(voxelShape, (VoxelShape)DIRECTION_HITBOX.get(direction));
|
voxelShape = VoxelShapes.union(voxelShape, (VoxelShape)DIRECTION_HITBOX.get(direction));
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package me.parsell.glowstonewire.core;
|
package me.parsell.glowstonewire.core;
|
||||||
|
|
||||||
import me.parsell.glowstonewire.GlowstoneWire;
|
import me.parsell.glowstonewire.GlowstoneWire;
|
||||||
import me.parsell.glowstonewire.mixin.BrewingRecipeRegistryAccessor;
|
import me.parsell.glowstonewire.mixin.BrewingRecipeRegistryInvoker;
|
||||||
import net.fabricmc.fabric.api.client.itemgroup.FabricItemGroupBuilder;
|
import net.fabricmc.fabric.api.client.itemgroup.FabricItemGroupBuilder;
|
||||||
import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
|
import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
|
||||||
import net.minecraft.item.BlockItem;
|
import net.minecraft.item.BlockItem;
|
||||||
@@ -19,26 +19,5 @@ public class glowItems {
|
|||||||
|
|
||||||
public static void init(){
|
public static void init(){
|
||||||
Registry.register(Registry.ITEM, new Identifier(GlowstoneWire.MODID, "glowstone_dust"), GLOWSTONE_DUST);
|
Registry.register(Registry.ITEM, new Identifier(GlowstoneWire.MODID, "glowstone_dust"), GLOWSTONE_DUST);
|
||||||
|
}
|
||||||
// Modded Glowstone Potion Recipes
|
|
||||||
// TODO: IF "replace" or "both" config is set
|
|
||||||
if (true) {
|
|
||||||
BrewingRecipeRegistryAccessor.registerPotionRecipe(Potions.WATER, GLOWSTONE_DUST, Potions.THICK);
|
|
||||||
BrewingRecipeRegistryAccessor.registerPotionRecipe(Potions.LEAPING, GLOWSTONE_DUST, Potions.STRONG_LEAPING);
|
|
||||||
BrewingRecipeRegistryAccessor.registerPotionRecipe(Potions.SLOWNESS, GLOWSTONE_DUST, Potions.STRONG_SLOWNESS);
|
|
||||||
BrewingRecipeRegistryAccessor.registerPotionRecipe(Potions.TURTLE_MASTER, GLOWSTONE_DUST, Potions.STRONG_TURTLE_MASTER);
|
|
||||||
BrewingRecipeRegistryAccessor.registerPotionRecipe(Potions.SWIFTNESS, GLOWSTONE_DUST, Potions.STRONG_SWIFTNESS);
|
|
||||||
BrewingRecipeRegistryAccessor.registerPotionRecipe(Potions.HEALING, GLOWSTONE_DUST, Potions.STRONG_HEALING);
|
|
||||||
BrewingRecipeRegistryAccessor.registerPotionRecipe(Potions.HARMING, GLOWSTONE_DUST, Potions.STRONG_HARMING);
|
|
||||||
BrewingRecipeRegistryAccessor.registerPotionRecipe(Potions.POISON, GLOWSTONE_DUST, Potions.STRONG_POISON);
|
|
||||||
BrewingRecipeRegistryAccessor.registerPotionRecipe(Potions.REGENERATION, GLOWSTONE_DUST, Potions.STRONG_REGENERATION);
|
|
||||||
BrewingRecipeRegistryAccessor.registerPotionRecipe(Potions.STRENGTH, GLOWSTONE_DUST, Potions.STRONG_STRENGTH);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Vanilla Glowstone -> Modded Glowstone
|
|
||||||
// TODO: IF "convert" or "both" config is set
|
|
||||||
if(true) {
|
|
||||||
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,125 @@
|
|||||||
|
package me.parsell.glowstonewire.core;
|
||||||
|
|
||||||
|
import com.google.gson.JsonArray;
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
|
||||||
|
import me.parsell.glowstonewire.GlowstoneWire;
|
||||||
|
|
||||||
|
public class glowLootTables {
|
||||||
|
public static JsonObject glowstonelootTable;
|
||||||
|
|
||||||
|
public static void init(){
|
||||||
|
if(GlowstoneWire.CONFIG.replaceGlowstoneDrop) {
|
||||||
|
JsonObject explosion;
|
||||||
|
JsonObject limitValues, limit;
|
||||||
|
JsonObject bonus, parametersValues;
|
||||||
|
JsonObject count, countValues;
|
||||||
|
JsonArray secondItemArray;
|
||||||
|
JsonObject secondItem;
|
||||||
|
|
||||||
|
JsonObject levelsValues, silktouch;
|
||||||
|
JsonArray enchantmentsArray;
|
||||||
|
JsonObject enchantments, match;
|
||||||
|
JsonArray firstItemArray;
|
||||||
|
JsonObject firstItem;
|
||||||
|
|
||||||
|
JsonArray alternativesArray;
|
||||||
|
JsonObject alternatives;
|
||||||
|
|
||||||
|
JsonArray rollsArray;
|
||||||
|
JsonObject rolls;
|
||||||
|
|
||||||
|
JsonArray lootPoolsArray;
|
||||||
|
|
||||||
|
explosion = new JsonObject();
|
||||||
|
explosion.addProperty("function", "minecraft:explosion_decay");
|
||||||
|
|
||||||
|
limit = new JsonObject();
|
||||||
|
limit.addProperty("function", "minecraft:limit_count");
|
||||||
|
limitValues = new JsonObject();
|
||||||
|
limitValues.addProperty("max", 4);
|
||||||
|
limitValues.addProperty("min", 1);
|
||||||
|
limit.add("limit", limitValues);
|
||||||
|
|
||||||
|
bonus = new JsonObject();
|
||||||
|
bonus.addProperty("function", "minecraft:apply_bonus");
|
||||||
|
bonus.addProperty("enchantment", "minecraft:fortune");
|
||||||
|
bonus.addProperty("formula", "minecraft:uniform_bonus_count");
|
||||||
|
parametersValues = new JsonObject();
|
||||||
|
parametersValues.addProperty("bonusMultiplier", 1);
|
||||||
|
bonus.add("parameters", parametersValues);
|
||||||
|
|
||||||
|
count = new JsonObject();
|
||||||
|
count.addProperty("function", "minecraft:set_count");
|
||||||
|
countValues = new JsonObject();
|
||||||
|
countValues.addProperty("min", 2.0);
|
||||||
|
countValues.addProperty("max", 4.0);
|
||||||
|
countValues.addProperty("type", "minecraft:uniform");
|
||||||
|
count.add("count", countValues);
|
||||||
|
|
||||||
|
secondItemArray = new JsonArray();
|
||||||
|
secondItemArray.add(count);
|
||||||
|
secondItemArray.add(bonus);
|
||||||
|
secondItemArray.add(limit);
|
||||||
|
secondItemArray.add(explosion);
|
||||||
|
|
||||||
|
secondItem = new JsonObject();
|
||||||
|
secondItem.addProperty("type", "minecraft:item");
|
||||||
|
secondItem.add("functions", secondItemArray);
|
||||||
|
secondItem.addProperty("name", "glowstonewire:glowstone_dust");
|
||||||
|
|
||||||
|
//
|
||||||
|
|
||||||
|
levelsValues = new JsonObject();
|
||||||
|
levelsValues.addProperty("min", 1);
|
||||||
|
silktouch = new JsonObject();
|
||||||
|
silktouch.addProperty("enchantment", "minecraft:silk_touch");
|
||||||
|
silktouch.add("levels", levelsValues);
|
||||||
|
|
||||||
|
enchantmentsArray = new JsonArray();
|
||||||
|
enchantmentsArray.add(silktouch);
|
||||||
|
enchantments = new JsonObject();
|
||||||
|
enchantments.add("enchantments", enchantmentsArray);
|
||||||
|
|
||||||
|
match = new JsonObject();
|
||||||
|
match.addProperty("condition", "minecraft:match_tool");
|
||||||
|
match.add("predicate", enchantments);
|
||||||
|
|
||||||
|
firstItemArray = new JsonArray();
|
||||||
|
firstItemArray.add(match);
|
||||||
|
|
||||||
|
firstItem = new JsonObject();
|
||||||
|
firstItem.addProperty("type", "minecraft:item");
|
||||||
|
firstItem.add("conditions", firstItemArray);
|
||||||
|
firstItem.addProperty("name", "minecraft:glowstone");
|
||||||
|
|
||||||
|
//
|
||||||
|
|
||||||
|
alternativesArray = new JsonArray();
|
||||||
|
alternativesArray.add(firstItem);
|
||||||
|
alternativesArray.add(secondItem);
|
||||||
|
|
||||||
|
alternatives = new JsonObject();
|
||||||
|
alternatives.addProperty("type", "minecraft:alternatives");
|
||||||
|
alternatives.add("children", alternativesArray);
|
||||||
|
|
||||||
|
//
|
||||||
|
|
||||||
|
rollsArray = new JsonArray();
|
||||||
|
rollsArray.add(alternatives);
|
||||||
|
|
||||||
|
rolls = new JsonObject();
|
||||||
|
rolls.addProperty("rolls", 1);
|
||||||
|
rolls.add("entries", rollsArray);
|
||||||
|
|
||||||
|
//
|
||||||
|
|
||||||
|
lootPoolsArray = new JsonArray();
|
||||||
|
lootPoolsArray.add(rolls);
|
||||||
|
|
||||||
|
glowstonelootTable = new JsonObject();
|
||||||
|
glowstonelootTable.addProperty("type", "minecraft:block");
|
||||||
|
glowstonelootTable.add("pools", lootPoolsArray);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
package me.parsell.glowstonewire.core;
|
||||||
|
|
||||||
|
import com.google.gson.JsonArray;
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
|
||||||
|
import me.parsell.glowstonewire.GlowstoneWire;
|
||||||
|
import me.parsell.glowstonewire.mixin.BrewingRecipeRegistryInvoker;
|
||||||
|
import me.parsell.glowstonewire.mixin.FireworkStarRecipeAccessor;
|
||||||
|
import net.minecraft.item.Items;
|
||||||
|
import net.minecraft.potion.Potions;
|
||||||
|
import net.minecraft.recipe.Ingredient;
|
||||||
|
|
||||||
|
public class glowRecipes {
|
||||||
|
public static JsonObject MODDED_TO_VANILLA;
|
||||||
|
public static JsonObject VANILLA_TO_MODDED;
|
||||||
|
|
||||||
|
public static void init(){
|
||||||
|
BrewingRecipeRegistryInvoker.registerPotionRecipe(Potions.WATER, glowItems.GLOWSTONE_DUST, Potions.THICK);
|
||||||
|
BrewingRecipeRegistryInvoker.registerPotionRecipe(Potions.LEAPING, glowItems.GLOWSTONE_DUST, Potions.STRONG_LEAPING);
|
||||||
|
BrewingRecipeRegistryInvoker.registerPotionRecipe(Potions.SLOWNESS, glowItems.GLOWSTONE_DUST, Potions.STRONG_SLOWNESS);
|
||||||
|
BrewingRecipeRegistryInvoker.registerPotionRecipe(Potions.TURTLE_MASTER, glowItems.GLOWSTONE_DUST, Potions.STRONG_TURTLE_MASTER);
|
||||||
|
BrewingRecipeRegistryInvoker.registerPotionRecipe(Potions.SWIFTNESS, glowItems.GLOWSTONE_DUST, Potions.STRONG_SWIFTNESS);
|
||||||
|
BrewingRecipeRegistryInvoker.registerPotionRecipe(Potions.HEALING, glowItems.GLOWSTONE_DUST, Potions.STRONG_HEALING);
|
||||||
|
BrewingRecipeRegistryInvoker.registerPotionRecipe(Potions.HARMING, glowItems.GLOWSTONE_DUST, Potions.STRONG_HARMING);
|
||||||
|
BrewingRecipeRegistryInvoker.registerPotionRecipe(Potions.POISON, glowItems.GLOWSTONE_DUST, Potions.STRONG_POISON);
|
||||||
|
BrewingRecipeRegistryInvoker.registerPotionRecipe(Potions.REGENERATION, glowItems.GLOWSTONE_DUST, Potions.STRONG_REGENERATION);
|
||||||
|
BrewingRecipeRegistryInvoker.registerPotionRecipe(Potions.STRENGTH, glowItems.GLOWSTONE_DUST, Potions.STRONG_STRENGTH);
|
||||||
|
|
||||||
|
// Manually reset the glowstone compability, since i cant find a way to read and reset.
|
||||||
|
Ingredient defaultFSFlickerModifier = FireworkStarRecipeAccessor.getFlickerModifier();
|
||||||
|
FireworkStarRecipeAccessor.setFlickerModifier(Ingredient.ofItems(Items.GLOWSTONE_DUST, glowItems.GLOWSTONE_DUST));
|
||||||
|
|
||||||
|
if(GlowstoneWire.CONFIG.addConversionRecipes) {
|
||||||
|
// Base JsonObjects
|
||||||
|
JsonObject cIngredientVanilla = new JsonObject();
|
||||||
|
JsonObject CIngredientModded = new JsonObject();
|
||||||
|
JsonArray cIngredientsList = new JsonArray();
|
||||||
|
|
||||||
|
cIngredientVanilla.addProperty("item", "minecraft:glowstone_dust");
|
||||||
|
CIngredientModded.addProperty("item", "glowstonewire:glowstone_dust");
|
||||||
|
|
||||||
|
// FOR VANILLA TO MODDED
|
||||||
|
VANILLA_TO_MODDED = new JsonObject();
|
||||||
|
// Header, defining what type of crafting recipe it is
|
||||||
|
VANILLA_TO_MODDED.addProperty("type", "minecraft:crafting_shapeless");
|
||||||
|
// Adding the ingredients
|
||||||
|
cIngredientsList.add(cIngredientVanilla);
|
||||||
|
VANILLA_TO_MODDED.add("ingredients", cIngredientsList);
|
||||||
|
// Adding the result
|
||||||
|
VANILLA_TO_MODDED.add("result", CIngredientModded);
|
||||||
|
|
||||||
|
// Clearing out the old array for new
|
||||||
|
cIngredientsList = new JsonArray();
|
||||||
|
|
||||||
|
// FOR MODDED TO VANILLA
|
||||||
|
MODDED_TO_VANILLA = new JsonObject();
|
||||||
|
// Define recipe type
|
||||||
|
MODDED_TO_VANILLA.addProperty("type", "minecraft:crafting_shapeless");
|
||||||
|
// Add ingredients
|
||||||
|
cIngredientsList.add(CIngredientModded);
|
||||||
|
MODDED_TO_VANILLA.add("ingredients", cIngredientsList);
|
||||||
|
// Add result
|
||||||
|
MODDED_TO_VANILLA.add("result", cIngredientVanilla);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+1
-1
@@ -8,7 +8,7 @@ import net.minecraft.potion.Potion;
|
|||||||
import net.minecraft.recipe.BrewingRecipeRegistry;
|
import net.minecraft.recipe.BrewingRecipeRegistry;
|
||||||
|
|
||||||
@Mixin(BrewingRecipeRegistry.class)
|
@Mixin(BrewingRecipeRegistry.class)
|
||||||
public interface BrewingRecipeRegistryAccessor {
|
public interface BrewingRecipeRegistryInvoker {
|
||||||
@Invoker("registerPotionRecipe")
|
@Invoker("registerPotionRecipe")
|
||||||
public static void registerPotionRecipe(Potion input, Item item, Potion output) {
|
public static void registerPotionRecipe(Potion input, Item item, Potion output) {
|
||||||
throw new AssertionError();
|
throw new AssertionError();
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package me.parsell.glowstonewire.mixin;
|
||||||
|
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||||
|
|
||||||
|
import net.minecraft.recipe.FireworkStarRecipe;
|
||||||
|
import net.minecraft.recipe.Ingredient;
|
||||||
|
|
||||||
|
@Mixin(FireworkStarRecipe.class)
|
||||||
|
public interface FireworkStarRecipeAccessor {
|
||||||
|
@Accessor("FLICKER_MODIFIER")
|
||||||
|
public static Ingredient getFlickerModifier(){
|
||||||
|
throw new AssertionError();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Accessor("FLICKER_MODIFIER")
|
||||||
|
public static void setFlickerModifier(Ingredient FLICKER_MODIFIER){
|
||||||
|
throw new AssertionError();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package me.parsell.glowstonewire.mixin;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import com.google.gson.JsonElement;
|
||||||
|
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
|
import me.parsell.glowstonewire.GlowstoneWire;
|
||||||
|
import me.parsell.glowstonewire.core.glowLootTables;
|
||||||
|
import net.minecraft.loot.LootManager;
|
||||||
|
import net.minecraft.resource.ResourceManager;
|
||||||
|
import net.minecraft.util.Identifier;
|
||||||
|
import net.minecraft.util.profiler.Profiler;
|
||||||
|
|
||||||
|
@Mixin(LootManager.class)
|
||||||
|
public class LootManagerInjector {
|
||||||
|
@Inject(method = "apply", at = @At("HEAD"))
|
||||||
|
public void interceptApply(Map<Identifier, JsonElement> map, ResourceManager resourceManager, Profiler profiler, CallbackInfo info) {
|
||||||
|
if (GlowstoneWire.CONFIG.replaceGlowstoneDrop) {
|
||||||
|
map.put(new Identifier("minecraft", "blocks/glowstone"), glowLootTables.glowstonelootTable);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package me.parsell.glowstonewire.mixin;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import com.google.gson.JsonElement;
|
||||||
|
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
|
import me.parsell.glowstonewire.GlowstoneWire;
|
||||||
|
import me.parsell.glowstonewire.core.glowRecipes;
|
||||||
|
import net.minecraft.recipe.RecipeManager;
|
||||||
|
import net.minecraft.resource.ResourceManager;
|
||||||
|
import net.minecraft.util.Identifier;
|
||||||
|
import net.minecraft.util.profiler.Profiler;
|
||||||
|
|
||||||
|
@Mixin(RecipeManager.class)
|
||||||
|
public class RecipeManagerInjector {
|
||||||
|
@Inject(method = "apply", at = @At("HEAD"))
|
||||||
|
public void interceptApply(Map<Identifier, JsonElement> map, ResourceManager resourceManager, Profiler profiler, CallbackInfo info) {
|
||||||
|
if (GlowstoneWire.CONFIG.addConversionRecipes) {
|
||||||
|
map.put(new Identifier(GlowstoneWire.MODID, "glowstone_vanilla_modded"), glowRecipes.VANILLA_TO_MODDED);
|
||||||
|
map.put(new Identifier(GlowstoneWire.MODID, "glowstone_modded_vanilla"), glowRecipes.MODDED_TO_VANILLA);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"type": "minecraft:block",
|
||||||
|
"pools": [
|
||||||
|
{
|
||||||
|
"rolls": 1,
|
||||||
|
"entries": [
|
||||||
|
{
|
||||||
|
"type": "minecraft:item",
|
||||||
|
"name": "glowstonewire:glowstone_dust"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"conditions": [
|
||||||
|
{
|
||||||
|
"condition": "minecraft:survives_explosion"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"type": "minecraft:crafting_shaped",
|
||||||
|
"pattern": [
|
||||||
|
"##",
|
||||||
|
"##"
|
||||||
|
],
|
||||||
|
"key": {
|
||||||
|
"#": {
|
||||||
|
"item": "glowstonewire:glowstone_dust"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"result": {
|
||||||
|
"item": "minecraft:glowstone"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"type": "minecraft:crafting_shaped",
|
||||||
|
"pattern": [
|
||||||
|
" # ",
|
||||||
|
"#X#",
|
||||||
|
" # "
|
||||||
|
],
|
||||||
|
"key": {
|
||||||
|
"#": {
|
||||||
|
"item": "glowstonewire:glowstone_dust"
|
||||||
|
},
|
||||||
|
"X": {
|
||||||
|
"item": "minecraft:arrow"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"result": {
|
||||||
|
"item": "minecraft:spectral_arrow",
|
||||||
|
"count": 2
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"schemaVersion": 1,
|
"schemaVersion": 1,
|
||||||
"id": "glowstonewire",
|
"id": "glowstonewire",
|
||||||
"version": "${version}",
|
"version": "1.0.0",
|
||||||
|
|
||||||
"name": "Glowstone Wire",
|
"name": "Glowstone Wire",
|
||||||
"description": "Adds redstone like dust in the form of glowstone, used to emit a lower light level in a small form factor",
|
"description": "Adds redstone like dust in the form of glowstone, used to emit a lower light level in a small form factor",
|
||||||
@@ -9,8 +9,8 @@
|
|||||||
"Ganku (Badjman)"
|
"Ganku (Badjman)"
|
||||||
],
|
],
|
||||||
"contact": {
|
"contact": {
|
||||||
"homepage": "https://fabricmc.net/",
|
"homepage": "",
|
||||||
"sources": "https://github.com/FabricMC/fabric-example-mod"
|
"sources": "https://git.parsell.me/Justi/GlowstoneWire/"
|
||||||
},
|
},
|
||||||
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
@@ -26,14 +26,15 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"mixins": [
|
"mixins": [
|
||||||
|
"glowstonewire.mixins.json"
|
||||||
],
|
],
|
||||||
|
|
||||||
"depends": {
|
"depends": {
|
||||||
"fabricloader": ">=0.7.4",
|
"fabricloader": ">=0.7.4",
|
||||||
"fabric": "*",
|
"fabric": "*",
|
||||||
"minecraft": "1.16.x"
|
"minecraft": "1.16.x",
|
||||||
|
"cloth-config2": ">=4.11.26"
|
||||||
},
|
},
|
||||||
"suggests": {
|
"suggests": {
|
||||||
"another-mod": "*"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"required": true,
|
||||||
|
"minVersion": "0.8",
|
||||||
|
"package": "me.parsell.glowstonewire.mixin",
|
||||||
|
"compatibilityLevel": "JAVA_8",
|
||||||
|
"mixins": [
|
||||||
|
],
|
||||||
|
"client": [
|
||||||
|
"BrewingRecipeRegistryInvoker",
|
||||||
|
"RecipeManagerInjector",
|
||||||
|
"LootManagerInjector",
|
||||||
|
"FireworkStarRecipeAccessor"
|
||||||
|
],
|
||||||
|
"injectors": {
|
||||||
|
"defaultRequire": 1
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user