Last porty for the day

This commit is contained in:
grimmauld 2020-09-22 22:28:51 +02:00
parent f01aeee43e
commit a142cfdb85
43 changed files with 102 additions and 88 deletions

View file

@ -217,7 +217,7 @@ public abstract class KineticTileEntity extends SmartTileEntity
// DO NOT READ kinetic information when placed after movement // DO NOT READ kinetic information when placed after movement
if (wasMoved) { if (wasMoved) {
super.read(compound, clientPacket); super.fromTag(compound, clientPacket);
return; return;
} }
@ -237,7 +237,7 @@ public abstract class KineticTileEntity extends SmartTileEntity
overStressed = capacity < stress && StressImpact.isEnabled(); overStressed = capacity < stress && StressImpact.isEnabled();
} }
super.read(compound, clientPacket); super.fromTag(compound, clientPacket);
if (clientPacket && overStressedBefore != overStressed && speed != 0) if (clientPacket && overStressedBefore != overStressed && speed != 0)
effects.triggerOverStressedEffect(); effects.triggerOverStressedEffect();

View file

@ -225,7 +225,7 @@ public class CrushingWheelControllerTileEntity extends SmartTileEntity {
@Override @Override
protected void read(CompoundNBT compound, boolean clientPacket) { protected void read(CompoundNBT compound, boolean clientPacket) {
super.read(compound, clientPacket); super.fromTag(compound, clientPacket);
if (compound.contains("Entity") && !isFrozen() && !isOccupied()) { if (compound.contains("Entity") && !isFrozen() && !isOccupied()) {
entityUUID = NBTUtil.readUniqueId(compound.getCompound("Entity")); entityUUID = NBTUtil.readUniqueId(compound.getCompound("Entity"));
this.searchForEntity = true; this.searchForEntity = true;

View file

@ -51,7 +51,7 @@ public class NozzleTileEntity extends SmartTileEntity {
@Override @Override
protected void read(CompoundNBT compound, boolean clientPacket) { protected void read(CompoundNBT compound, boolean clientPacket) {
super.read(compound, clientPacket); super.fromTag(compound, clientPacket);
if (!clientPacket) if (!clientPacket)
return; return;
range = compound.getFloat("Range"); range = compound.getFloat("Range");

View file

@ -169,7 +169,7 @@ public class SpoutTileEntity extends SmartTileEntity {
@Override @Override
protected void read(CompoundNBT compound, boolean clientPacket) { protected void read(CompoundNBT compound, boolean clientPacket) {
super.read(compound, clientPacket); super.fromTag(compound, clientPacket);
tank.readFromNBT(compound.getCompound("TankContent")); tank.readFromNBT(compound.getCompound("TankContent"));
fluidLevel.readNBT(compound.getCompound("Level"), clientPacket); fluidLevel.readNBT(compound.getCompound("Level"), clientPacket);
processingTicks = compound.getInt("ProcessingTicks"); processingTicks = compound.getInt("ProcessingTicks");

View file

@ -278,7 +278,7 @@ public class FluidTankTileEntity extends SmartTileEntity {
@Override @Override
protected void read(CompoundNBT compound, boolean clientPacket) { protected void read(CompoundNBT compound, boolean clientPacket) {
super.read(compound, clientPacket); super.fromTag(compound, clientPacket);
BlockPos controllerBefore = controller; BlockPos controllerBefore = controller;
int prevSize = width; int prevSize = width;

View file

@ -62,7 +62,7 @@ public class BasinTileEntity extends SmartTileEntity implements ITickableTileEnt
@Override @Override
protected void read(CompoundNBT compound, boolean clientPacket) { protected void read(CompoundNBT compound, boolean clientPacket) {
super.read(compound, clientPacket); super.fromTag(compound, clientPacket);
inputInventory.deserializeNBT(compound.getCompound("InputItems")); inputInventory.deserializeNBT(compound.getCompound("InputItems"));
outputInventory.deserializeNBT(compound.getCompound("OutputItems")); outputInventory.deserializeNBT(compound.getCompound("OutputItems"));
if (compound.contains("fluids")) if (compound.contains("fluids"))

View file

@ -17,6 +17,7 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipeSerializer; import net.minecraft.item.crafting.IRecipeSerializer;
import net.minecraft.item.crafting.Ingredient; import net.minecraft.item.crafting.Ingredient;
import net.minecraft.tags.ITag;
import net.minecraft.tags.Tag; import net.minecraft.tags.Tag;
import net.minecraft.util.IItemProvider; import net.minecraft.util.IItemProvider;
import net.minecraft.util.NonNullList; import net.minecraft.util.NonNullList;
@ -103,7 +104,7 @@ public class ProcessingRecipeBuilder<T extends ProcessingRecipe<?>> {
// Datagen shortcuts // Datagen shortcuts
public ProcessingRecipeBuilder<T> require(Tag<Item> tag) { public ProcessingRecipeBuilder<T> require(ITag.INamedTag<Item> tag) {
return require(Ingredient.fromTag(tag)); return require(Ingredient.fromTag(tag));
} }
@ -120,7 +121,7 @@ public class ProcessingRecipeBuilder<T extends ProcessingRecipe<?>> {
return require(FluidIngredient.fromFluid(fluid, amount)); return require(FluidIngredient.fromFluid(fluid, amount));
} }
public ProcessingRecipeBuilder<T> require(Tag<Fluid> fluidTag, int amount) { public ProcessingRecipeBuilder<T> require(ITag.INamedTag<Fluid> fluidTag, int amount) {
return require(FluidIngredient.fromTag(fluidTag, amount)); return require(FluidIngredient.fromTag(fluidTag, amount));
} }

View file

@ -165,7 +165,7 @@ public class BlazeBurnerTileEntity extends SmartTileEntity {
protected void read(CompoundNBT compound, boolean clientPacket) { protected void read(CompoundNBT compound, boolean clientPacket) {
activeFuel = FuelType.values()[compound.getInt("fuelLevel")]; activeFuel = FuelType.values()[compound.getInt("fuelLevel")];
remainingBurnTime = compound.getInt("burnTimeRemaining"); remainingBurnTime = compound.getInt("burnTimeRemaining");
super.read(compound, clientPacket); super.fromTag(compound, clientPacket);
} }
/** /**

View file

@ -81,7 +81,7 @@ public class BeltObserverTileEntity extends SmartTileEntity {
@Override @Override
protected void read(CompoundNBT compound, boolean clientPacket) { protected void read(CompoundNBT compound, boolean clientPacket) {
turnOffTicks = compound.getInt("TurnOff"); turnOffTicks = compound.getInt("TurnOff");
super.read(compound, clientPacket); super.fromTag(compound, clientPacket);
} }
} }

View file

@ -92,7 +92,7 @@ public class BeltTunnelTileEntity extends SmartTileEntity {
.target(0) .target(0)
.withSpeed(.05f)); .withSpeed(.05f));
super.read(compound, clientPacket); super.fromTag(compound, clientPacket);
if (!clientPacket) if (!clientPacket)
return; return;

View file

@ -476,7 +476,7 @@ public class ChuteTileEntity extends SmartTileEntity implements IHaveGoggleInfor
pull = compound.getFloat("Pull"); pull = compound.getFloat("Pull");
push = compound.getFloat("Push"); push = compound.getFloat("Push");
bottomPullDistance = compound.getFloat("BottomAirFlowDistance"); bottomPullDistance = compound.getFloat("BottomAirFlowDistance");
super.read(compound, clientPacket); super.fromTag(compound, clientPacket);
if (hasWorld() && world.isRemote && !previousItem.equals(item, false) && !item.isEmpty()) { if (hasWorld() && world.isRemote && !previousItem.equals(item, false) && !item.isEmpty()) {
if (world.rand.nextInt(3) != 0) if (world.rand.nextInt(3) != 0)

View file

@ -110,7 +110,7 @@ public class DepotTileEntity extends SmartTileEntity {
if (compound.contains("HeldItem")) if (compound.contains("HeldItem"))
heldItem = TransportedItemStack.read(compound.getCompound("HeldItem")); heldItem = TransportedItemStack.read(compound.getCompound("HeldItem"));
processingOutputBuffer.deserializeNBT(compound.getCompound("OutputBuffer")); processingOutputBuffer.deserializeNBT(compound.getCompound("OutputBuffer"));
super.read(compound, clientPacket); super.fromTag(compound, clientPacket);
} }
@Override @Override

View file

@ -46,7 +46,7 @@ public class AdjustableRepeaterTileEntity extends SmartTileEntity {
protected void read(CompoundNBT compound, boolean clientPacket) { protected void read(CompoundNBT compound, boolean clientPacket) {
state = compound.getInt("State"); state = compound.getInt("State");
charging = compound.getBoolean("Charging"); charging = compound.getBoolean("Charging");
super.read(compound, clientPacket); super.fromTag(compound, clientPacket);
} }
@Override @Override

View file

@ -241,7 +241,7 @@ public class FunnelTileEntity extends SmartTileEntity {
@Override @Override
protected void read(CompoundNBT compound, boolean clientPacket) { protected void read(CompoundNBT compound, boolean clientPacket) {
super.read(compound, clientPacket); super.fromTag(compound, clientPacket);
extractionCooldown = compound.getInt("TransferCooldown"); extractionCooldown = compound.getInt("TransferCooldown");
if (clientPacket && compound.contains("Flap")) { if (clientPacket && compound.contains("Flap")) {
int direction = compound.getInt("Flap"); int direction = compound.getInt("Flap");

View file

@ -153,7 +153,7 @@ public class AdjustableCrateTileEntity extends CrateTileEntity implements INamed
protected void read(CompoundNBT compound, boolean clientPacket) { protected void read(CompoundNBT compound, boolean clientPacket) {
allowedAmount = compound.getInt("AllowedAmount"); allowedAmount = compound.getInt("AllowedAmount");
inventory.deserializeNBT(compound.getCompound("Inventory")); inventory.deserializeNBT(compound.getCompound("Inventory"));
super.read(compound, clientPacket); super.fromTag(compound, clientPacket);
} }
@Override @Override

View file

@ -35,7 +35,7 @@ public class AnalogLeverTileEntity extends SmartTileEntity implements IHaveGoggl
state = compound.getInt("State"); state = compound.getInt("State");
lastChange = compound.getInt("ChangeTimer"); lastChange = compound.getInt("ChangeTimer");
clientState.target(state); clientState.target(state);
super.read(compound, clientPacket); super.fromTag(compound, clientPacket);
} }
@Override @Override

View file

@ -75,7 +75,7 @@ public class RedstoneLinkTileEntity extends SmartTileEntity {
@Override @Override
protected void read(CompoundNBT compound, boolean clientPacket) { protected void read(CompoundNBT compound, boolean clientPacket) {
transmitter = compound.getBoolean("Transmitter"); transmitter = compound.getBoolean("Transmitter");
super.read(compound, clientPacket); super.fromTag(compound, clientPacket);
receivedSignal = compound.getInt("Receive"); receivedSignal = compound.getInt("Receive");
receivedSignalChanged = compound.getBoolean("ReceivedChanged"); receivedSignalChanged = compound.getBoolean("ReceivedChanged");

View file

@ -42,7 +42,7 @@ public class StockpileSwitchTileEntity extends SmartTileEntity {
currentLevel = compound.getFloat("Current"); currentLevel = compound.getFloat("Current");
powered = compound.getBoolean("Powered"); powered = compound.getBoolean("Powered");
super.read(compound, clientPacket); super.fromTag(compound, clientPacket);
} }
@Override @Override

View file

@ -196,7 +196,7 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC
if (compound.contains("FlyingBlocks")) if (compound.contains("FlyingBlocks"))
readFlyingBlocks(compound); readFlyingBlocks(compound);
super.read(compound, clientPacket); super.fromTag(compound, clientPacket);
} }
protected void readFlyingBlocks(CompoundNBT compound) { protected void readFlyingBlocks(CompoundNBT compound) {

View file

@ -13,6 +13,7 @@ import com.simibubi.create.Create;
import net.minecraft.advancements.ICriterionTrigger; import net.minecraft.advancements.ICriterionTrigger;
import net.minecraft.advancements.PlayerAdvancements; import net.minecraft.advancements.PlayerAdvancements;
import net.minecraft.advancements.criterion.CriterionInstance; import net.minecraft.advancements.criterion.CriterionInstance;
import net.minecraft.advancements.criterion.EntityPredicate;
import net.minecraft.entity.player.ServerPlayerEntity; import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
@ -73,8 +74,8 @@ public abstract class CriterionTriggerBase<T extends CriterionTriggerBase.Instan
protected abstract static class Instance extends CriterionInstance { protected abstract static class Instance extends CriterionInstance {
public Instance(ResourceLocation idIn) { public Instance(ResourceLocation idIn, EntityPredicate.AndPredicate p_i231464_2_) {
super(idIn); super(idIn, p_i231464_2_);
} }
protected abstract boolean test(List<Supplier<Object>> suppliers); protected abstract boolean test(List<Supplier<Object>> suppliers);

View file

@ -92,7 +92,7 @@ public class CTModel extends BakedModelWrapper<IBakedModel> {
continue; continue;
BakedQuad newQuad = new BakedQuad(Arrays.copyOf(quad.getVertexData(), quad.getVertexData().length), BakedQuad newQuad = new BakedQuad(Arrays.copyOf(quad.getVertexData(), quad.getVertexData().length),
quad.getTintIndex(), quad.getFace(), quad.getSprite(), quad.shouldApplyDiffuseLighting()); quad.getTintIndex(), quad.getFace(), quad.getSprite(), quad.hasShade());
VertexFormat format = DefaultVertexFormats.BLOCK; VertexFormat format = DefaultVertexFormats.BLOCK;
int[] vertexData = newQuad.getVertexData(); int[] vertexData = newQuad.getVertexData();

View file

@ -44,7 +44,7 @@ public class ColoredVertexModel extends BakedModelWrapper<IBakedModel> {
for (int i = 0; i < quads.size(); i++) { for (int i = 0; i < quads.size(); i++) {
BakedQuad quad = quads.get(i); BakedQuad quad = quads.get(i);
BakedQuad newQuad = new BakedQuad(Arrays.copyOf(quad.getVertexData(), quad.getVertexData().length), BakedQuad newQuad = new BakedQuad(Arrays.copyOf(quad.getVertexData(), quad.getVertexData().length),
quad.getTintIndex(), quad.getFace(), quad.getSprite(), quad.shouldApplyDiffuseLighting()); quad.getTintIndex(), quad.getFace(), quad.getSprite(), quad.hasShade());
VertexFormat format = DefaultVertexFormats.BLOCK; VertexFormat format = DefaultVertexFormats.BLOCK;
int[] vertexData = newQuad.getVertexData(); int[] vertexData = newQuad.getVertexData();

View file

@ -5,6 +5,7 @@ import com.simibubi.create.foundation.item.PartialItemModelRenderer;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.model.ItemCameraTransforms;
import net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer; import net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -12,7 +13,7 @@ public class CustomRenderedItemModelRenderer<M extends CustomRenderedItemModel>
@Override @Override
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public void render(ItemStack stack, MatrixStack ms, IRenderTypeBuffer buffer, int light, int overlay) { public void render(ItemStack stack, ItemCameraTransforms.TransformType p_239207_2_, MatrixStack ms, IRenderTypeBuffer buffer, int light, int overlay) {
M mainModel = ((M) Minecraft.getInstance() M mainModel = ((M) Minecraft.getInstance()
.getItemRenderer() .getItemRenderer()
.getItemModelWithOverrides(stack, null, null)); .getItemModelWithOverrides(stack, null, null));

View file

@ -42,11 +42,11 @@ public class KillTPSCommand {
} }
return 1; return 1;
}).then(Commands.argument(Lang.translate("command.killTPSCommand.argument.tickTime"), }).then(Commands.argument(Lang.translate("command.killTPSCommand.argument.tickTime").getUnformattedComponentText(),
IntegerArgumentType.integer(1)).executes(ctx -> { IntegerArgumentType.integer(1)).executes(ctx -> {
// killtps start tickTime // killtps start tickTime
int tickTime = IntegerArgumentType.getInteger(ctx, int tickTime = IntegerArgumentType.getInteger(ctx,
Lang.translate("command.killTPSCommand.argument.tickTime")); Lang.translate("command.killTPSCommand.argument.tickTime").getUnformattedComponentText());
Create.lagger.setTickTime(tickTime); Create.lagger.setTickTime(tickTime);
Create.lagger.setLagging(true); Create.lagger.setLagging(true);
ctx.getSource().sendFeedback((Lang.createTranslationTextComponent( ctx.getSource().sendFeedback((Lang.createTranslationTextComponent(

View file

@ -13,7 +13,7 @@ import net.minecraft.data.DataGenerator;
import net.minecraft.data.IFinishedRecipe; import net.minecraft.data.IFinishedRecipe;
import net.minecraft.data.RecipeProvider; import net.minecraft.data.RecipeProvider;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.tags.Tag; import net.minecraft.tags.ITag;
import net.minecraft.util.IItemProvider; import net.minecraft.util.IItemProvider;
import net.minecraftforge.common.Tags; import net.minecraftforge.common.Tags;
@ -46,19 +46,19 @@ public abstract class CreateRecipeProvider extends RecipeProvider {
protected static class I { protected static class I {
static Tag<Item> redstone() { static ITag.INamedTag<Item> redstone() {
return Tags.Items.DUSTS_REDSTONE; return Tags.Items.DUSTS_REDSTONE;
} }
static Tag<Item> gold() { static ITag.INamedTag<Item> gold() {
return AllTags.forgeItemTag("ingots/gold"); return AllTags.forgeItemTag("ingots/gold");
} }
static Tag<Item> goldSheet() { static ITag.INamedTag<Item> goldSheet() {
return AllTags.forgeItemTag("plates/gold"); return AllTags.forgeItemTag("plates/gold");
} }
static Tag<Item> stone() { static ITag.INamedTag<Item> stone() {
return Tags.Items.STONE; return Tags.Items.STONE;
} }
@ -78,23 +78,23 @@ public abstract class CreateRecipeProvider extends RecipeProvider {
return AllBlocks.ANDESITE_CASING.get(); return AllBlocks.ANDESITE_CASING.get();
} }
static Tag<Item> brass() { static ITag.INamedTag<Item> brass() {
return AllTags.forgeItemTag("ingots/brass"); return AllTags.forgeItemTag("ingots/brass");
} }
static Tag<Item> brassSheet() { static ITag.INamedTag<Item> brassSheet() {
return AllTags.forgeItemTag("plates/brass"); return AllTags.forgeItemTag("plates/brass");
} }
static Tag<Item> iron() { static ITag.INamedTag<Item> iron() {
return Tags.Items.INGOTS_IRON; return Tags.Items.INGOTS_IRON;
} }
static Tag<Item> zinc() { static ITag.INamedTag<Item> zinc() {
return AllTags.forgeItemTag("ingots/zinc"); return AllTags.forgeItemTag("ingots/zinc");
} }
static Tag<Item> ironSheet() { static ITag.INamedTag<Item> ironSheet() {
return AllTags.forgeItemTag("plates/iron"); return AllTags.forgeItemTag("plates/iron");
} }
@ -110,35 +110,35 @@ public abstract class CreateRecipeProvider extends RecipeProvider {
return AllItems.INTEGRATED_CIRCUIT.get(); return AllItems.INTEGRATED_CIRCUIT.get();
} }
static Tag<Item> copperBlock() { static ITag.INamedTag<Item> copperBlock() {
return AllTags.forgeItemTag("storage_blocks/copper"); return AllTags.forgeItemTag("storage_blocks/copper");
} }
static Tag<Item> brassBlock() { static ITag.INamedTag<Item> brassBlock() {
return AllTags.forgeItemTag("storage_blocks/brass"); return AllTags.forgeItemTag("storage_blocks/brass");
} }
static Tag<Item> zincBlock() { static ITag.INamedTag<Item> zincBlock() {
return AllTags.forgeItemTag("storage_blocks/zinc"); return AllTags.forgeItemTag("storage_blocks/zinc");
} }
static Tag<Item> copper() { static ITag.INamedTag<Item> copper() {
return AllTags.forgeItemTag("ingots/copper"); return AllTags.forgeItemTag("ingots/copper");
} }
static Tag<Item> copperSheet() { static ITag.INamedTag<Item> copperSheet() {
return AllTags.forgeItemTag("plates/copper"); return AllTags.forgeItemTag("plates/copper");
} }
static Tag<Item> copperNugget() { static ITag.INamedTag<Item> copperNugget() {
return AllTags.forgeItemTag("nuggets/copper"); return AllTags.forgeItemTag("nuggets/copper");
} }
static Tag<Item> brassNugget() { static ITag.INamedTag<Item> brassNugget() {
return AllTags.forgeItemTag("nuggets/brass"); return AllTags.forgeItemTag("nuggets/brass");
} }
static Tag<Item> zincNugget() { static ITag.INamedTag<Item> zincNugget() {
return AllTags.forgeItemTag("nuggets/zinc"); return AllTags.forgeItemTag("nuggets/zinc");
} }

View file

@ -14,6 +14,7 @@ import net.minecraft.fluid.Fluid;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundNBT;
import net.minecraft.network.PacketBuffer; import net.minecraft.network.PacketBuffer;
import net.minecraft.tags.FluidTags; import net.minecraft.tags.FluidTags;
import net.minecraft.tags.ITag;
import net.minecraft.tags.Tag; import net.minecraft.tags.Tag;
import net.minecraft.util.JSONUtils; import net.minecraft.util.JSONUtils;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
@ -23,7 +24,7 @@ public abstract class FluidIngredient implements Predicate<FluidStack> {
public static final FluidIngredient EMPTY = new FluidStackIngredient(); public static final FluidIngredient EMPTY = new FluidStackIngredient();
public static FluidIngredient fromTag(Tag<Fluid> tag, int amount) { public static FluidIngredient fromTag(ITag.INamedTag<Fluid> tag, int amount) {
FluidTagIngredient ingredient = new FluidTagIngredient(); FluidTagIngredient ingredient = new FluidTagIngredient();
ingredient.tag = tag; ingredient.tag = tag;
ingredient.amountRequired = amount; ingredient.amountRequired = amount;
@ -158,7 +159,7 @@ public abstract class FluidIngredient implements Predicate<FluidStack> {
public static class FluidTagIngredient extends FluidIngredient { public static class FluidTagIngredient extends FluidIngredient {
protected Tag<Fluid> tag; protected ITag.INamedTag<Fluid> tag;
@Override @Override
protected boolean testInternal(FluidStack t) { protected boolean testInternal(FluidStack t) {
@ -169,7 +170,7 @@ public abstract class FluidIngredient implements Predicate<FluidStack> {
@Override @Override
protected void readInternal(PacketBuffer buffer) { protected void readInternal(PacketBuffer buffer) {
ResourceLocation resourcelocation = buffer.readResourceLocation(); ResourceLocation resourcelocation = buffer.readResourceLocation();
tag = FluidTags.getContainer() tag = FluidTags.func_226157_a_()
.get(resourcelocation); .get(resourcelocation);
} }
@ -181,7 +182,7 @@ public abstract class FluidIngredient implements Predicate<FluidStack> {
@Override @Override
protected void readInternal(JsonObject json) { protected void readInternal(JsonObject json) {
ResourceLocation id = new ResourceLocation(JSONUtils.getString(json, "fluidTag")); ResourceLocation id = new ResourceLocation(JSONUtils.getString(json, "fluidTag"));
tag = FluidTags.getContainer() tag = FluidTags.func_226157_a_()
.get(id); .get(id);
if (tag == null) if (tag == null)
throw new JsonSyntaxException("Unknown fluid tag '" + id + "'"); throw new JsonSyntaxException("Unknown fluid tag '" + id + "'");

View file

@ -14,7 +14,7 @@ public class WipScription extends ItemDescription {
public WipScription(Palette palette) { public WipScription(Palette palette) {
super(palette); super(palette);
add(getLines(), TextFormatting.RED + Lang.translate("tooltip.workInProgress")); add(getLines(), Lang.translate("tooltip.workInProgress").formatted(TextFormatting.RED));
int descriptions = 0; int descriptions = 0;
while (I18n.hasKey("create.tooltip.randomWipDescription" + descriptions++)) while (I18n.hasKey("create.tooltip.randomWipDescription" + descriptions++))
@ -22,7 +22,7 @@ public class WipScription extends ItemDescription {
if (--descriptions > 0) { if (--descriptions > 0) {
int index = new Random().nextInt(descriptions); int index = new Random().nextInt(descriptions);
String translate = Lang.translate("tooltip.randomWipDescription" + index); ITextComponent translate = Lang.translate("tooltip.randomWipDescription" + index);
add(getLines(), TooltipHelper.cutString(translate, TextFormatting.DARK_RED, TextFormatting.DARK_RED)); add(getLines(), TooltipHelper.cutString(translate, TextFormatting.DARK_RED, TextFormatting.DARK_RED));
} }
} }

View file

@ -8,6 +8,7 @@ import java.util.function.Consumer;
import com.simibubi.create.foundation.tileEntity.behaviour.BehaviourType; import com.simibubi.create.foundation.tileEntity.behaviour.BehaviourType;
import net.minecraft.block.BlockState;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundNBT;
import net.minecraft.tileentity.ITickableTileEntity; import net.minecraft.tileentity.ITickableTileEntity;
import net.minecraft.tileentity.TileEntityType; import net.minecraft.tileentity.TileEntityType;
@ -75,26 +76,26 @@ public abstract class SmartTileEntity extends SyncedTileEntity implements ITicka
} }
@Override @Override
public final void readClientUpdate(CompoundNBT tag) { public final void readClientUpdate(BlockState state, CompoundNBT tag) {
read(tag, true); fromTag(state, tag, true);
} }
@Override @Override
public final void read(CompoundNBT tag) { public final void fromTag(BlockState state, CompoundNBT tag) {
read(tag, false); fromTag(state, tag, false);
} }
/** /**
* Hook only these in future subclasses of STE * Hook only these in future subclasses of STE
*/ */
protected void read(CompoundNBT compound, boolean clientPacket) { protected void fromTag(BlockState state, CompoundNBT compound, boolean clientPacket) {
if (firstNbtRead) { if (firstNbtRead) {
firstNbtRead = false; firstNbtRead = false;
ArrayList<TileEntityBehaviour> list = new ArrayList<>(); ArrayList<TileEntityBehaviour> list = new ArrayList<>();
addBehavioursDeferred(list); addBehavioursDeferred(list);
list.forEach(b -> behaviours.put(b.getType(), b)); list.forEach(b -> behaviours.put(b.getType(), b));
} }
super.read(compound); super.fromTag(state, compound);
behaviours.values() behaviours.values()
.forEach(tb -> tb.read(compound, clientPacket)); .forEach(tb -> tb.read(compound, clientPacket));
} }

View file

@ -18,13 +18,15 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.vector.Vector3d; import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.util.text.IFormattableTextComponent;
import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
public class ValueBox extends ChasingAABBOutline { public class ValueBox extends ChasingAABBOutline {
protected ITextComponent label = ITextComponent.of("Value Box"); protected ITextComponent label = ITextComponent.of("Value Box");
protected ITextComponent sublabel = ITextComponent.of(""); protected ITextComponent sublabel = ITextComponent.of("");
protected String scrollTooltip = ""; protected ITextComponent scrollTooltip = StringTextComponent.EMPTY;
protected Vector3d labelOffset = Vector3d.ZERO; protected Vector3d labelOffset = Vector3d.ZERO;
protected int passiveColor; protected int passiveColor;
@ -57,7 +59,7 @@ public class ValueBox extends ChasingAABBOutline {
return this; return this;
} }
public ValueBox scrollTooltip(String scrollTip) { public ValueBox scrollTooltip(ITextComponent scrollTip) {
this.scrollTooltip = scrollTip; this.scrollTooltip = scrollTip;
return this; return this;
} }
@ -108,7 +110,7 @@ public class ValueBox extends ChasingAABBOutline {
ms.translate(0, 10, 0); ms.translate(0, 10, 0);
renderHoveringText(ms, buffer, sublabel); renderHoveringText(ms, buffer, sublabel);
} }
if (!scrollTooltip.isEmpty()) { if (!scrollTooltip.getUnformattedComponentText().isEmpty()) {
ms.translate(0, 10, 0); ms.translate(0, 10, 0);
renderHoveringText(ms, buffer, scrollTooltip, 0x998899, 0x111111); renderHoveringText(ms, buffer, scrollTooltip, 0x998899, 0x111111);
} }
@ -125,7 +127,7 @@ public class ValueBox extends ChasingAABBOutline {
ItemStack stack; ItemStack stack;
int count; int count;
public ItemValueBox(String label, AxisAlignedBB bb, BlockPos pos, ItemStack stack, int count) { public ItemValueBox(ITextComponent label, AxisAlignedBB bb, BlockPos pos, ItemStack stack, int count) {
super(label, bb, pos); super(label, bb, pos);
this.stack = stack; this.stack = stack;
this.count = count; this.count = count;
@ -135,13 +137,13 @@ public class ValueBox extends ChasingAABBOutline {
public void renderContents(MatrixStack ms, IRenderTypeBuffer buffer) { public void renderContents(MatrixStack ms, IRenderTypeBuffer buffer) {
super.renderContents(ms, buffer); super.renderContents(ms, buffer);
FontRenderer font = Minecraft.getInstance().fontRenderer; FontRenderer font = Minecraft.getInstance().fontRenderer;
String countString = count == 0 ? "*" : count + ""; ITextComponent countString = ITextComponent.of(count == 0 ? "*" : count + "");
ms.translate(17.5f, -5f, 7f); ms.translate(17.5f, -5f, 7f);
boolean isFilter = stack.getItem() instanceof FilterItem; boolean isFilter = stack.getItem() instanceof FilterItem;
boolean isEmpty = stack.isEmpty(); boolean isEmpty = stack.isEmpty();
float scale = 1.5f; float scale = 1.5f;
ms.translate(-font.getStringWidth(countString), 0, 0); ms.translate(-font.getWidth(countString), 0, 0);
if (isFilter) if (isFilter)
ms.translate(3, 8, 7.25f); ms.translate(3, 8, 7.25f);
@ -194,7 +196,7 @@ public class ValueBox extends ChasingAABBOutline {
public static class IconValueBox extends ValueBox { public static class IconValueBox extends ValueBox {
AllIcons icon; AllIcons icon;
public IconValueBox(String label, INamedIconOptions iconValue, AxisAlignedBB bb, BlockPos pos) { public IconValueBox(ITextComponent label, INamedIconOptions iconValue, AxisAlignedBB bb, BlockPos pos) {
super(label, bb, pos); super(label, bb, pos);
subLabel(Lang.translate(iconValue.getTranslationKey())); subLabel(Lang.translate(iconValue.getTranslationKey()));
icon = iconValue.getIcon(); icon = iconValue.getIcon();

View file

@ -2,6 +2,7 @@ package com.simibubi.create.foundation.tileEntity.behaviour;
import java.util.function.Function; import java.util.function.Function;
import com.simibubi.create.foundation.utility.BlockHelper;
import org.apache.commons.lang3.tuple.Pair; import org.apache.commons.lang3.tuple.Pair;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
@ -46,9 +47,9 @@ public abstract class ValueBoxTransform {
protected Vector3d rotateHorizontally(BlockState state, Vector3d vec) { protected Vector3d rotateHorizontally(BlockState state, Vector3d vec) {
float yRot = 0; float yRot = 0;
if (state.has(BlockStateProperties.FACING)) if (BlockHelper.hasBlockStateProperty(state, BlockStateProperties.FACING))
yRot = AngleHelper.horizontalAngle(state.get(BlockStateProperties.FACING)); yRot = AngleHelper.horizontalAngle(state.get(BlockStateProperties.FACING));
if (state.has(BlockStateProperties.HORIZONTAL_FACING)) if (BlockHelper.hasBlockStateProperty(state, BlockStateProperties.HORIZONTAL_FACING))
yRot = AngleHelper.horizontalAngle(state.get(BlockStateProperties.HORIZONTAL_FACING)); yRot = AngleHelper.horizontalAngle(state.get(BlockStateProperties.HORIZONTAL_FACING));
return VecHelper.rotateCentered(vec, yRot, Axis.Y); return VecHelper.rotateCentered(vec, yRot, Axis.Y);
} }

View file

@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour; import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
import com.simibubi.create.foundation.utility.BlockHelper;
import com.simibubi.create.foundation.utility.RaycastHelper; import com.simibubi.create.foundation.utility.RaycastHelper;
import net.minecraft.block.Block; import net.minecraft.block.Block;
@ -61,14 +62,14 @@ public class EdgeInteractionHandler {
public static List<Direction> getConnectiveSides(World world, BlockPos pos, Direction face, public static List<Direction> getConnectiveSides(World world, BlockPos pos, Direction face,
EdgeInteractionBehaviour behaviour) { EdgeInteractionBehaviour behaviour) {
List<Direction> sides = new ArrayList<>(6); List<Direction> sides = new ArrayList<>(6);
if (Block.hasSolidSide(world.getBlockState(pos.offset(face)), world, pos.offset(face), face.getOpposite())) if (BlockHelper.hasBlockSolidSide(world.getBlockState(pos.offset(face)), world, pos.offset(face), face.getOpposite()))
return sides; return sides;
for (Direction direction : Direction.values()) { for (Direction direction : Direction.values()) {
if (direction.getAxis() == face.getAxis()) if (direction.getAxis() == face.getAxis())
continue; continue;
BlockPos neighbourPos = pos.offset(direction); BlockPos neighbourPos = pos.offset(direction);
if (Block.hasSolidSide(world.getBlockState(neighbourPos.offset(face)), world, neighbourPos.offset(face), if (BlockHelper.hasBlockSolidSide(world.getBlockState(neighbourPos.offset(face)), world, neighbourPos.offset(face),
face.getOpposite())) face.getOpposite()))
continue; continue;
if (!behaviour.connectivityPredicate.test(world, pos, face, direction)) if (!behaviour.connectivityPredicate.test(world, pos, face, direction))

View file

@ -19,6 +19,7 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult; import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.RayTraceResult; import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.vector.Vector3d; import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.util.text.StringTextComponent;
public class EdgeInteractionRenderer { public class EdgeInteractionRenderer {
@ -63,7 +64,7 @@ public class EdgeInteractionRenderer {
AxisAlignedBB bb = EdgeInteractionHandler.getBB(pos, closestEdge); AxisAlignedBB bb = EdgeInteractionHandler.getBB(pos, closestEdge);
boolean hit = bb.contains(target.getHitVec()); boolean hit = bb.contains(target.getHitVec());
ValueBox box = new ValueBox("", bb.offset(-pos.getX(), -pos.getY(), -pos.getZ()), pos); ValueBox box = new ValueBox(StringTextComponent.EMPTY, bb.offset(-pos.getX(), -pos.getY(), -pos.getZ()), pos);
Vector3d textOffset = Vector3d.ZERO; Vector3d textOffset = Vector3d.ZERO;
boolean positive = closestEdge.getAxisDirection() == AxisDirection.POSITIVE; boolean positive = closestEdge.getAxisDirection() == AxisDirection.POSITIVE;

View file

@ -26,6 +26,9 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult; import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.RayTraceResult; import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.vector.Vector3d; import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.util.text.IFormattableTextComponent;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
public class FilteringRenderer { public class FilteringRenderer {
@ -60,7 +63,7 @@ public class FilteringRenderer {
ItemStack filter = behaviour.getFilter(); ItemStack filter = behaviour.getFilter();
boolean isFilterSlotted = filter.getItem() instanceof FilterItem; boolean isFilterSlotted = filter.getItem() instanceof FilterItem;
boolean showCount = behaviour.isCountVisible(); boolean showCount = behaviour.isCountVisible();
String label = isFilterSlotted ? "" ITextComponent label = isFilterSlotted ? StringTextComponent.EMPTY
: Lang.translate(behaviour.recipeFilter ? "logistics.recipe_filter" : "logistics.filter"); : Lang.translate(behaviour.recipeFilter ? "logistics.recipe_filter" : "logistics.filter");
boolean hit = behaviour.slotPositioning.testHit(state, target.getHitVec() boolean hit = behaviour.slotPositioning.testHit(state, target.getHitVec()
.subtract(Vector3d.of(pos))); .subtract(Vector3d.of(pos)));
@ -73,7 +76,7 @@ public class FilteringRenderer {
box.offsetLabel(behaviour.textShift) box.offsetLabel(behaviour.textShift)
.withColors(0x7A6A2C, 0xB79D64) .withColors(0x7A6A2C, 0xB79D64)
.scrollTooltip(showCount ? "[" + Lang.translate("action.scroll") + "]" : "") .scrollTooltip(ITextComponent.of(showCount ? "[" + Lang.translate("action.scroll").getUnformattedComponentText() + "]" : ""))
.passive(!hit); .passive(!hit);
CreateClient.outliner.showValueBox(Pair.of("filter", pos), box.transform(behaviour.slotPositioning)) CreateClient.outliner.showValueBox(Pair.of("filter", pos), box.transform(behaviour.slotPositioning))

View file

@ -12,6 +12,7 @@ import com.simibubi.create.foundation.tileEntity.behaviour.BehaviourType;
import com.simibubi.create.foundation.tileEntity.behaviour.filtering.FilteringBehaviour; import com.simibubi.create.foundation.tileEntity.behaviour.filtering.FilteringBehaviour;
import com.simibubi.create.foundation.utility.BlockFace; import com.simibubi.create.foundation.utility.BlockFace;
import com.simibubi.create.foundation.utility.BlockHelper;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.state.properties.BlockStateProperties;
@ -173,13 +174,13 @@ public class InvManipulationBehaviour extends TileEntityBehaviour {
public interface InterfaceProvider { public interface InterfaceProvider {
public static InterfaceProvider towardBlockFacing() { public static InterfaceProvider towardBlockFacing() {
return (w, p, s) -> new BlockFace(p, s.has(BlockStateProperties.FACING) ? s.get(BlockStateProperties.FACING) return (w, p, s) -> new BlockFace(p, BlockHelper.hasBlockStateProperty(s, BlockStateProperties.FACING) ? s.get(BlockStateProperties.FACING)
: s.get(BlockStateProperties.HORIZONTAL_FACING)); : s.get(BlockStateProperties.HORIZONTAL_FACING));
} }
public static InterfaceProvider oppositeOfBlockFacing() { public static InterfaceProvider oppositeOfBlockFacing() {
return (w, p, s) -> new BlockFace(p, return (w, p, s) -> new BlockFace(p,
(s.has(BlockStateProperties.FACING) ? s.get(BlockStateProperties.FACING) (BlockHelper.hasBlockStateProperty(s, BlockStateProperties.FACING) ? s.get(BlockStateProperties.FACING)
: s.get(BlockStateProperties.HORIZONTAL_FACING)).getOpposite()); : s.get(BlockStateProperties.HORIZONTAL_FACING)).getOpposite());
} }

View file

@ -21,6 +21,7 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult; import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.RayTraceResult; import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.vector.Vector3d; import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.util.text.ITextComponent;
public class LinkRenderer { public class LinkRenderer {
@ -38,12 +39,12 @@ public class LinkRenderer {
if (behaviour == null) if (behaviour == null)
return; return;
String freq1 = Lang.translate("logistics.firstFrequency"); ITextComponent freq1 = Lang.translate("logistics.firstFrequency");
String freq2 = Lang.translate("logistics.secondFrequency"); ITextComponent freq2 = Lang.translate("logistics.secondFrequency");
for (boolean first : Iterate.trueAndFalse) { for (boolean first : Iterate.trueAndFalse) {
AxisAlignedBB bb = new AxisAlignedBB(Vector3d.ZERO, Vector3d.ZERO).grow(.25f); AxisAlignedBB bb = new AxisAlignedBB(Vector3d.ZERO, Vector3d.ZERO).grow(.25f);
String label = first ? freq2 : freq1; ITextComponent label = first ? freq2 : freq1;
boolean hit = behaviour.testHit(first, target.getHitVec()); boolean hit = behaviour.testHit(first, target.getHitVec());
ValueBoxTransform transform = first ? behaviour.firstSlot : behaviour.secondSlot; ValueBoxTransform transform = first ? behaviour.firstSlot : behaviour.secondSlot;

View file

@ -5,12 +5,13 @@ import java.util.function.Function;
import com.simibubi.create.foundation.tileEntity.SmartTileEntity; import com.simibubi.create.foundation.tileEntity.SmartTileEntity;
import com.simibubi.create.foundation.tileEntity.behaviour.ValueBoxTransform; import com.simibubi.create.foundation.tileEntity.behaviour.ValueBoxTransform;
import net.minecraft.util.text.ITextComponent;
public class BulkScrollValueBehaviour extends ScrollValueBehaviour { public class BulkScrollValueBehaviour extends ScrollValueBehaviour {
Function<SmartTileEntity, List<? extends SmartTileEntity>> groupGetter; Function<SmartTileEntity, List<? extends SmartTileEntity>> groupGetter;
public BulkScrollValueBehaviour(String label, SmartTileEntity te, ValueBoxTransform slot, public BulkScrollValueBehaviour(ITextComponent label, SmartTileEntity te, ValueBoxTransform slot,
Function<SmartTileEntity, List<? extends SmartTileEntity>> groupGetter) { Function<SmartTileEntity, List<? extends SmartTileEntity>> groupGetter) {
super(label, te, slot); super(label, te, slot);
this.groupGetter = groupGetter; this.groupGetter = groupGetter;

View file

@ -64,10 +64,10 @@ public class ScrollValueRenderer {
} else { } else {
box = new TextValueBox(label, bb, pos, behaviour.formatValue()); box = new TextValueBox(label, bb, pos, behaviour.formatValue());
if (behaviour.unit != null) if (behaviour.unit != null)
box.subLabel("(" + behaviour.unit.apply(behaviour.scrollableValue) + ")"); box.subLabel(ITextComponent.of("(" + behaviour.unit.apply(behaviour.scrollableValue) + ")"));
} }
box.scrollTooltip("[" + Lang.translate("action.scroll") + "]"); box.scrollTooltip(ITextComponent.of("[" + Lang.translate("action.scroll").getUnformattedComponentText() + "]"));
box.offsetLabel(behaviour.textShift.add(20, -10, 0)) box.offsetLabel(behaviour.textShift.add(20, -10, 0))
.withColors(0x5A5D5A, 0xB5B7B6) .withColors(0x5A5D5A, 0xB5B7B6)
.passive(!highlight); .passive(!highlight);

View file

@ -47,7 +47,7 @@ public class DyeHelper {
} }
} }
public static Tag<Item> getTagOfDye(DyeColor color) { public static Tags.IOptionalNamedTag<Item> getTagOfDye(DyeColor color) {
switch (color) { switch (color) {
case BLACK: case BLACK:
return Tags.Items.DYES_BLACK; return Tags.Items.DYES_BLACK;

View file

@ -208,7 +208,7 @@ public class TreeCutter {
} }
private static boolean isLeaf(BlockState state) { private static boolean isLeaf(BlockState state) {
return state.has(LeavesBlock.DISTANCE); return BlockHelper.hasBlockStateProperty(state, LeavesBlock.DISTANCE);
} }
} }

View file

@ -7,8 +7,6 @@ import java.util.function.Function;
import org.apache.commons.lang3.mutable.MutableObject; import org.apache.commons.lang3.mutable.MutableObject;
import com.simibubi.create.content.contraptions.relays.belt.Vector3i;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.Direction.Axis; import net.minecraft.util.Direction.Axis;

View file

@ -54,7 +54,7 @@ public enum AllWorldFeatures {
for (AllWorldFeatures entry : AllWorldFeatures.values()) { for (AllWorldFeatures entry : AllWorldFeatures.values()) {
for (Biome biome : ForgeRegistries.BIOMES) { for (Biome biome : ForgeRegistries.BIOMES) {
if (biome == Biomes.THE_VOID) if (biome.getRegistryName() == Biomes.THE_VOID.getRegistryName())
continue; continue;
if (biome == Biomes.NETHER) if (biome == Biomes.NETHER)
continue; continue;

View file

@ -66,7 +66,7 @@ public abstract class OreFeature<T extends IPlacementConfig> extends ConfigBase
Pair<Placement<T>, T> placement = getPlacement(); Pair<Placement<T>, T> placement = getPlacement();
ConfiguredFeature<?, ?> createdFeature = Feature.ORE ConfiguredFeature<?, ?> createdFeature = Feature.ORE
.configure(new OreFeatureConfig(OreFeatureConfig.FillerBlockType.NATURAL_STONE, block.get() .configure(new OreFeatureConfig(OreFeatureConfig.FillerBlockType.BASE_STONE_OVERWORLD, block.get()
.getDefaultState(), clusterSize.get())) .getDefaultState(), clusterSize.get()))
.createDecoratedFeature(placement.getKey() .createDecoratedFeature(placement.getKey()
.configure(placement.getValue())); .configure(placement.getValue()));

View file

@ -54,7 +54,7 @@ public class OxidizingBlock extends Block {
if (!worldIn.isBlockPresent(neighbourPos)) if (!worldIn.isBlockPresent(neighbourPos))
continue; continue;
BlockState neighborState = worldIn.getBlockState(neighbourPos); BlockState neighborState = worldIn.getBlockState(neighbourPos);
if (neighborState.func_235903_d_(OXIDIZATION).map(ox -> ox != 0).orElse(false)) { if (BlockHelper.hasBlockStateProperty(neighborState, OXIDIZATION) && neighborState.get(OXIDIZATION) != 0) {
neighbors.add(neighborState.get(OXIDIZATION)); neighbors.add(neighborState.get(OXIDIZATION));
} }
if (BlockHelper.hasBlockSolidSide(neighborState, worldIn, neighbourPos, facing.getOpposite())) { if (BlockHelper.hasBlockSolidSide(neighborState, worldIn, neighbourPos, facing.getOpposite())) {