From 6420f541946c6459a4a964e74e3fa32680110755 Mon Sep 17 00:00:00 2001 From: PepperCode1 <44146161+PepperCode1@users.noreply.github.com> Date: Thu, 24 Feb 2022 17:32:33 -0800 Subject: [PATCH] Add tags for blaze burner fuel - `#create:blaze_burner_regular_fuel`: these items are treated like coal by the blaze burner if they cannot be used as fuel in a furnace - `#create:blaze_burner_special_fuel`: these items cause the blaze burner to become superheated - Fix equipable item attribute - Fix SandPaperItem overriding both getItemEnchantability and getEnchantmentValue --- src/generated/resources/.cache/cache | 2 + .../tags/items/blaze_burner_regular_fuel.json | 4 + .../tags/items/blaze_burner_special_fuel.json | 6 + .../java/com/simibubi/create/AllItems.java | 2 +- .../java/com/simibubi/create/AllTags.java | 5 +- .../base/KineticTileInstance.java | 120 +++++++++--------- .../base/SingleRotatingInstance.java | 46 +++---- .../burner/BlazeBurnerTileEntity.java | 7 +- .../curiosities/tools/SandPaperItem.java | 7 +- .../logistics/item/filter/ItemAttribute.java | 4 +- .../foundation/render/AllInstanceFormats.java | 8 +- .../foundation/render/AllProgramSpecs.java | 1 - 12 files changed, 113 insertions(+), 99 deletions(-) create mode 100644 src/generated/resources/data/create/tags/items/blaze_burner_regular_fuel.json create mode 100644 src/generated/resources/data/create/tags/items/blaze_burner_special_fuel.json diff --git a/src/generated/resources/.cache/cache b/src/generated/resources/.cache/cache index a1855cc4f..5189526df 100644 --- a/src/generated/resources/.cache/cache +++ b/src/generated/resources/.cache/cache @@ -5194,6 +5194,8 @@ d063e12c9ef75f39518c6d129ea35d833464d547 data/create/tags/blocks/toolboxes.json eac71740fb12bdb38b5dfaa2268613d7ba82b809 data/create/tags/blocks/windmill_sails.json 74700d556ca80c7a1db5fd4efb09c3ddb26cad66 data/create/tags/blocks/windowable.json 893a01e6004d6d8272bd1658e98da88bb572ee57 data/create/tags/blocks/wrench_pickup.json +74700d556ca80c7a1db5fd4efb09c3ddb26cad66 data/create/tags/items/blaze_burner_regular_fuel.json +97061ef67cac1fafd869493d06115b968bcb99bf data/create/tags/items/blaze_burner_special_fuel.json 5212172aee2239136c94f9868ad39ec2e17cf1c6 data/create/tags/items/create_ingots.json 4480f211f4a37bfee193eba945bc9f5a8d2c6e34 data/create/tags/items/crushed_ores.json bce28787b0271382842823d04a977912a88b01c2 data/create/tags/items/sandpaper.json diff --git a/src/generated/resources/data/create/tags/items/blaze_burner_regular_fuel.json b/src/generated/resources/data/create/tags/items/blaze_burner_regular_fuel.json new file mode 100644 index 000000000..5e8aecc98 --- /dev/null +++ b/src/generated/resources/data/create/tags/items/blaze_burner_regular_fuel.json @@ -0,0 +1,4 @@ +{ + "replace": false, + "values": [] +} \ No newline at end of file diff --git a/src/generated/resources/data/create/tags/items/blaze_burner_special_fuel.json b/src/generated/resources/data/create/tags/items/blaze_burner_special_fuel.json new file mode 100644 index 000000000..db4cbee8b --- /dev/null +++ b/src/generated/resources/data/create/tags/items/blaze_burner_special_fuel.json @@ -0,0 +1,6 @@ +{ + "replace": false, + "values": [ + "create:blaze_cake" + ] +} \ No newline at end of file diff --git a/src/main/java/com/simibubi/create/AllItems.java b/src/main/java/com/simibubi/create/AllItems.java index 84f52369b..cbdb13591 100644 --- a/src/main/java/com/simibubi/create/AllItems.java +++ b/src/main/java/com/simibubi/create/AllItems.java @@ -100,7 +100,7 @@ public class AllItems { .register(); public static final ItemEntry BLAZE_CAKE = REGISTRATE.item("blaze_cake", CombustibleItem::new) - .tag(AllItemTags.UPRIGHT_ON_BELT.tag) + .tag(AllItemTags.BLAZE_BURNER_SPECIAL_FUEL.tag, AllItemTags.UPRIGHT_ON_BELT.tag) .onRegister(i -> i.setBurnTime(6400)) .register(); diff --git a/src/main/java/com/simibubi/create/AllTags.java b/src/main/java/com/simibubi/create/AllTags.java index c7922a7f9..27e7a6457 100644 --- a/src/main/java/com/simibubi/create/AllTags.java +++ b/src/main/java/com/simibubi/create/AllTags.java @@ -106,6 +106,7 @@ public class AllTags { BRITTLE, FAN_HEATERS, FAN_TRANSPARENT, + ORE_OVERRIDE_STONE, SAFE_NBT, SAILS, SEATS, @@ -114,8 +115,6 @@ public class AllTags { WINDMILL_SAILS, WINDOWABLE, WRENCH_PICKUP, - - ORE_OVERRIDE_STONE, WG_STONE(FORGE), @@ -184,6 +183,8 @@ public class AllTags { public enum AllItemTags { + BLAZE_BURNER_REGULAR_FUEL, + BLAZE_BURNER_SPECIAL_FUEL, CREATE_INGOTS, CRUSHED_ORES, SANDPAPER, diff --git a/src/main/java/com/simibubi/create/content/contraptions/base/KineticTileInstance.java b/src/main/java/com/simibubi/create/content/contraptions/base/KineticTileInstance.java index a0553a25e..b580a5f61 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/base/KineticTileInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/base/KineticTileInstance.java @@ -14,84 +14,84 @@ import net.minecraft.world.level.block.state.BlockState; public abstract class KineticTileInstance extends BlockEntityInstance { - protected final Direction.Axis axis; + protected final Direction.Axis axis; - public KineticTileInstance(MaterialManager modelManager, T tile) { - super(modelManager, tile); + public KineticTileInstance(MaterialManager modelManager, T tile) { + super(modelManager, tile); - axis = ((IRotate) blockState.getBlock()).getRotationAxis(blockState); - } + axis = ((IRotate) blockState.getBlock()).getRotationAxis(blockState); + } - protected final void updateRotation(RotatingData instance) { - updateRotation(instance, getRotationAxis(), getTileSpeed()); - } + protected final void updateRotation(RotatingData instance) { + updateRotation(instance, getRotationAxis(), getTileSpeed()); + } - protected final void updateRotation(RotatingData instance, Direction.Axis axis) { - updateRotation(instance, axis, getTileSpeed()); - } + protected final void updateRotation(RotatingData instance, Direction.Axis axis) { + updateRotation(instance, axis, getTileSpeed()); + } - protected final void updateRotation(RotatingData instance, float speed) { - updateRotation(instance, getRotationAxis(), speed); - } + protected final void updateRotation(RotatingData instance, float speed) { + updateRotation(instance, getRotationAxis(), speed); + } - protected final void updateRotation(RotatingData instance, Direction.Axis axis, float speed) { - instance.setRotationAxis(axis) - .setRotationOffset(getRotationOffset(axis)) - .setRotationalSpeed(speed) - .setColor(blockEntity); - } + protected final void updateRotation(RotatingData instance, Direction.Axis axis, float speed) { + instance.setRotationAxis(axis) + .setRotationOffset(getRotationOffset(axis)) + .setRotationalSpeed(speed) + .setColor(blockEntity); + } - protected final RotatingData setup(RotatingData key) { - return setup(key, getRotationAxis(), getTileSpeed()); - } + protected final RotatingData setup(RotatingData key) { + return setup(key, getRotationAxis(), getTileSpeed()); + } - protected final RotatingData setup(RotatingData key, Direction.Axis axis) { - return setup(key, axis, getTileSpeed()); - } + protected final RotatingData setup(RotatingData key, Direction.Axis axis) { + return setup(key, axis, getTileSpeed()); + } - protected final RotatingData setup(RotatingData key, float speed) { - return setup(key, getRotationAxis(), speed); - } + protected final RotatingData setup(RotatingData key, float speed) { + return setup(key, getRotationAxis(), speed); + } - protected final RotatingData setup(RotatingData key, Direction.Axis axis, float speed) { - key.setRotationAxis(axis) - .setRotationalSpeed(speed) - .setRotationOffset(getRotationOffset(axis)) - .setColor(blockEntity) - .setPosition(getInstancePosition()); + protected final RotatingData setup(RotatingData key, Direction.Axis axis, float speed) { + key.setRotationAxis(axis) + .setRotationalSpeed(speed) + .setRotationOffset(getRotationOffset(axis)) + .setColor(blockEntity) + .setPosition(getInstancePosition()); - return key; - } + return key; + } - protected float getRotationOffset(final Direction.Axis axis) { - float offset = ICogWheel.isLargeCog(blockState) ? 11.25f : 0; - double d = (((axis == Direction.Axis.X) ? 0 : pos.getX()) + ((axis == Direction.Axis.Y) ? 0 : pos.getY()) - + ((axis == Direction.Axis.Z) ? 0 : pos.getZ())) % 2; - if (d == 0) { - offset = 22.5f; - } - return offset; - } + protected float getRotationOffset(final Direction.Axis axis) { + float offset = ICogWheel.isLargeCog(blockState) ? 11.25f : 0; + double d = (((axis == Direction.Axis.X) ? 0 : pos.getX()) + ((axis == Direction.Axis.Y) ? 0 : pos.getY()) + + ((axis == Direction.Axis.Z) ? 0 : pos.getZ())) % 2; + if (d == 0) { + offset = 22.5f; + } + return offset; + } - protected Direction.Axis getRotationAxis() { - return axis; - } + protected Direction.Axis getRotationAxis() { + return axis; + } - protected float getTileSpeed() { - return blockEntity.getSpeed(); - } + protected float getTileSpeed() { + return blockEntity.getSpeed(); + } - protected BlockState shaft() { - return shaft(getRotationAxis()); - } + protected BlockState shaft() { + return shaft(getRotationAxis()); + } - protected Material getRotatingMaterial() { + protected Material getRotatingMaterial() { return materialManager.defaultSolid() .material(AllMaterialSpecs.ROTATING); } - public static BlockState shaft(Direction.Axis axis) { - return AllBlocks.SHAFT.getDefaultState() - .setValue(ShaftBlock.AXIS, axis); - } + public static BlockState shaft(Direction.Axis axis) { + return AllBlocks.SHAFT.getDefaultState() + .setValue(ShaftBlock.AXIS, axis); + } } diff --git a/src/main/java/com/simibubi/create/content/contraptions/base/SingleRotatingInstance.java b/src/main/java/com/simibubi/create/content/contraptions/base/SingleRotatingInstance.java index e708b85c5..d103b26b5 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/base/SingleRotatingInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/base/SingleRotatingInstance.java @@ -10,35 +10,35 @@ public class SingleRotatingInstance extends KineticTileInstance getModel() { - return getRotatingMaterial().getModel(getRenderedBlockState()); - } + protected Instancer getModel() { + return getRotatingMaterial().getModel(getRenderedBlockState()); + } } diff --git a/src/main/java/com/simibubi/create/content/contraptions/processing/burner/BlazeBurnerTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/processing/burner/BlazeBurnerTileEntity.java index 934dc3504..f1e861dae 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/processing/burner/BlazeBurnerTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/processing/burner/BlazeBurnerTileEntity.java @@ -4,6 +4,7 @@ import java.util.List; import java.util.Random; import com.simibubi.create.AllItems; +import com.simibubi.create.AllTags.AllItemTags; import com.simibubi.create.content.contraptions.particle.CubeParticleData; import com.simibubi.create.content.contraptions.processing.burner.BlazeBurnerBlock.HeatLevel; import com.simibubi.create.foundation.tileEntity.SmartTileEntity; @@ -169,13 +170,17 @@ public class BlazeBurnerTileEntity extends SmartTileEntity { FuelType newFuel = FuelType.NONE; int newBurnTime; - if (AllItems.BLAZE_CAKE.isIn(itemStack)) { + if (AllItemTags.BLAZE_BURNER_SPECIAL_FUEL.matches(itemStack)) { newBurnTime = 1000; newFuel = FuelType.SPECIAL; } else { newBurnTime = ForgeHooks.getBurnTime(itemStack, null); if (newBurnTime > 0) newFuel = FuelType.NORMAL; + else if (AllItemTags.BLAZE_BURNER_REGULAR_FUEL.matches(itemStack)) { + newBurnTime = 1600; // Same as coal + newFuel = FuelType.NORMAL; + } } if (newFuel == FuelType.NONE) diff --git a/src/main/java/com/simibubi/create/content/curiosities/tools/SandPaperItem.java b/src/main/java/com/simibubi/create/content/curiosities/tools/SandPaperItem.java index d8749856d..8963d5f5f 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/tools/SandPaperItem.java +++ b/src/main/java/com/simibubi/create/content/curiosities/tools/SandPaperItem.java @@ -238,14 +238,9 @@ public class SandPaperItem extends Item implements CustomUseEffectsItem { return 32; } - @Override - public int getItemEnchantability(ItemStack stack) { - return 1; - } - @Override public int getEnchantmentValue() { - return 5; + return 1; } @Override diff --git a/src/main/java/com/simibubi/create/content/logistics/item/filter/ItemAttribute.java b/src/main/java/com/simibubi/create/content/logistics/item/filter/ItemAttribute.java index 5a3f886a4..6a2e7e982 100644 --- a/src/main/java/com/simibubi/create/content/logistics/item/filter/ItemAttribute.java +++ b/src/main/java/com/simibubi/create/content/logistics/item/filter/ItemAttribute.java @@ -30,6 +30,8 @@ import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.TranslatableComponent; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.Container; +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.CreativeModeTab; import net.minecraft.world.item.Item; @@ -136,7 +138,7 @@ public interface ItemAttribute { DAMAGED(ItemStack::isDamaged), BADLY_DAMAGED(s -> s.isDamaged() && s.getDamageValue() / s.getMaxDamage() > 3 / 4f), NOT_STACKABLE(((Predicate) ItemStack::isStackable).negate()), - EQUIPABLE(s -> s.getEquipmentSlot() != null), + EQUIPABLE(s -> LivingEntity.getEquipmentSlotForItem(s).getType() != EquipmentSlot.Type.HAND), FURNACE_FUEL(AbstractFurnaceBlockEntity::isFuel), WASHABLE(InWorldProcessing::isWashable), HAUNTABLE(InWorldProcessing::isHauntable), diff --git a/src/main/java/com/simibubi/create/foundation/render/AllInstanceFormats.java b/src/main/java/com/simibubi/create/foundation/render/AllInstanceFormats.java index db8dddb0a..bcdfc481e 100644 --- a/src/main/java/com/simibubi/create/foundation/render/AllInstanceFormats.java +++ b/src/main/java/com/simibubi/create/foundation/render/AllInstanceFormats.java @@ -5,22 +5,22 @@ import com.jozufozu.flywheel.core.layout.CommonItems; public class AllInstanceFormats { - public static BufferLayout ROTATING = kineticInstance() + public static final BufferLayout ROTATING = kineticInstance() .addItems(CommonItems.NORMAL) .build(); - public static BufferLayout BELT = kineticInstance() + public static final BufferLayout BELT = kineticInstance() .addItems(CommonItems.QUATERNION, CommonItems.UV, CommonItems.VEC4, CommonItems.NORMALIZED_BYTE) .build(); - public static BufferLayout ACTOR = BufferLayout.builder() + public static final BufferLayout ACTOR = BufferLayout.builder() .addItems(CommonItems.VEC3, CommonItems.LIGHT, CommonItems.FLOAT, CommonItems.NORMAL, CommonItems.QUATERNION, CommonItems.NORMAL, CommonItems.FLOAT) .build(); - public static BufferLayout FLAP = BufferLayout.builder() + public static final BufferLayout FLAP = BufferLayout.builder() .addItems(CommonItems.VEC3, CommonItems.LIGHT, CommonItems.VEC3, CommonItems.VEC3, CommonItems.FLOAT, CommonItems.FLOAT, CommonItems.FLOAT, CommonItems.FLOAT) .build(); diff --git a/src/main/java/com/simibubi/create/foundation/render/AllProgramSpecs.java b/src/main/java/com/simibubi/create/foundation/render/AllProgramSpecs.java index d4fdc776e..ccf81b94f 100644 --- a/src/main/java/com/simibubi/create/foundation/render/AllProgramSpecs.java +++ b/src/main/java/com/simibubi/create/foundation/render/AllProgramSpecs.java @@ -7,7 +7,6 @@ import net.minecraft.resources.ResourceLocation; public class AllProgramSpecs { public static final ResourceLocation ROTATING = asResource("rotating"); - public static final ResourceLocation CHROMATIC = asResource("chromatic"); public static final ResourceLocation BELT = asResource("belt"); public static final ResourceLocation FLAPS = asResource("flap"); public static final ResourceLocation ACTOR = asResource("contraption_actor");