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
This commit is contained in:
PepperCode1 2022-02-24 17:32:33 -08:00
parent 0cf0d3930e
commit 6420f54194
12 changed files with 113 additions and 99 deletions

View file

@ -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

View file

@ -0,0 +1,4 @@
{
"replace": false,
"values": []
}

View file

@ -0,0 +1,6 @@
{
"replace": false,
"values": [
"create:blaze_cake"
]
}

View file

@ -100,7 +100,7 @@ public class AllItems {
.register();
public static final ItemEntry<CombustibleItem> 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();

View file

@ -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,

View file

@ -14,84 +14,84 @@ import net.minecraft.world.level.block.state.BlockState;
public abstract class KineticTileInstance<T extends KineticTileEntity> extends BlockEntityInstance<T> {
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<RotatingData> getRotatingMaterial() {
protected Material<RotatingData> 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);
}
}

View file

@ -10,35 +10,35 @@ public class SingleRotatingInstance extends KineticTileInstance<KineticTileEntit
protected RotatingData rotatingModel;
public SingleRotatingInstance(MaterialManager modelManager, KineticTileEntity tile) {
public SingleRotatingInstance(MaterialManager modelManager, KineticTileEntity tile) {
super(modelManager, tile);
}
@Override
public void init() {
rotatingModel = setup(getModel().createInstance());
}
@Override
public void init() {
rotatingModel = setup(getModel().createInstance());
}
@Override
public void update() {
updateRotation(rotatingModel);
}
@Override
public void update() {
updateRotation(rotatingModel);
}
@Override
public void updateLight() {
relight(pos, rotatingModel);
}
@Override
public void updateLight() {
relight(pos, rotatingModel);
}
@Override
public void remove() {
rotatingModel.delete();
}
@Override
public void remove() {
rotatingModel.delete();
}
protected BlockState getRenderedBlockState() {
return blockState;
}
protected BlockState getRenderedBlockState() {
return blockState;
}
protected Instancer<RotatingData> getModel() {
return getRotatingMaterial().getModel(getRenderedBlockState());
}
protected Instancer<RotatingData> getModel() {
return getRotatingMaterial().getModel(getRenderedBlockState());
}
}

View file

@ -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)

View file

@ -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

View file

@ -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>) 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),

View file

@ -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();

View file

@ -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");