mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-17 06:13:41 +01:00
Last porty for the day
This commit is contained in:
parent
f01aeee43e
commit
a142cfdb85
43 changed files with 102 additions and 88 deletions
|
@ -217,7 +217,7 @@ public abstract class KineticTileEntity extends SmartTileEntity
|
|||
|
||||
// DO NOT READ kinetic information when placed after movement
|
||||
if (wasMoved) {
|
||||
super.read(compound, clientPacket);
|
||||
super.fromTag(compound, clientPacket);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -237,7 +237,7 @@ public abstract class KineticTileEntity extends SmartTileEntity
|
|||
overStressed = capacity < stress && StressImpact.isEnabled();
|
||||
}
|
||||
|
||||
super.read(compound, clientPacket);
|
||||
super.fromTag(compound, clientPacket);
|
||||
|
||||
if (clientPacket && overStressedBefore != overStressed && speed != 0)
|
||||
effects.triggerOverStressedEffect();
|
||||
|
|
|
@ -225,7 +225,7 @@ public class CrushingWheelControllerTileEntity extends SmartTileEntity {
|
|||
|
||||
@Override
|
||||
protected void read(CompoundNBT compound, boolean clientPacket) {
|
||||
super.read(compound, clientPacket);
|
||||
super.fromTag(compound, clientPacket);
|
||||
if (compound.contains("Entity") && !isFrozen() && !isOccupied()) {
|
||||
entityUUID = NBTUtil.readUniqueId(compound.getCompound("Entity"));
|
||||
this.searchForEntity = true;
|
||||
|
|
|
@ -51,7 +51,7 @@ public class NozzleTileEntity extends SmartTileEntity {
|
|||
|
||||
@Override
|
||||
protected void read(CompoundNBT compound, boolean clientPacket) {
|
||||
super.read(compound, clientPacket);
|
||||
super.fromTag(compound, clientPacket);
|
||||
if (!clientPacket)
|
||||
return;
|
||||
range = compound.getFloat("Range");
|
||||
|
|
|
@ -169,7 +169,7 @@ public class SpoutTileEntity extends SmartTileEntity {
|
|||
|
||||
@Override
|
||||
protected void read(CompoundNBT compound, boolean clientPacket) {
|
||||
super.read(compound, clientPacket);
|
||||
super.fromTag(compound, clientPacket);
|
||||
tank.readFromNBT(compound.getCompound("TankContent"));
|
||||
fluidLevel.readNBT(compound.getCompound("Level"), clientPacket);
|
||||
processingTicks = compound.getInt("ProcessingTicks");
|
||||
|
|
|
@ -278,7 +278,7 @@ public class FluidTankTileEntity extends SmartTileEntity {
|
|||
|
||||
@Override
|
||||
protected void read(CompoundNBT compound, boolean clientPacket) {
|
||||
super.read(compound, clientPacket);
|
||||
super.fromTag(compound, clientPacket);
|
||||
|
||||
BlockPos controllerBefore = controller;
|
||||
int prevSize = width;
|
||||
|
|
|
@ -62,7 +62,7 @@ public class BasinTileEntity extends SmartTileEntity implements ITickableTileEnt
|
|||
|
||||
@Override
|
||||
protected void read(CompoundNBT compound, boolean clientPacket) {
|
||||
super.read(compound, clientPacket);
|
||||
super.fromTag(compound, clientPacket);
|
||||
inputInventory.deserializeNBT(compound.getCompound("InputItems"));
|
||||
outputInventory.deserializeNBT(compound.getCompound("OutputItems"));
|
||||
if (compound.contains("fluids"))
|
||||
|
|
|
@ -17,6 +17,7 @@ import net.minecraft.item.Item;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipeSerializer;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.tags.ITag;
|
||||
import net.minecraft.tags.Tag;
|
||||
import net.minecraft.util.IItemProvider;
|
||||
import net.minecraft.util.NonNullList;
|
||||
|
@ -103,7 +104,7 @@ public class ProcessingRecipeBuilder<T extends ProcessingRecipe<?>> {
|
|||
|
||||
// Datagen shortcuts
|
||||
|
||||
public ProcessingRecipeBuilder<T> require(Tag<Item> tag) {
|
||||
public ProcessingRecipeBuilder<T> require(ITag.INamedTag<Item> tag) {
|
||||
return require(Ingredient.fromTag(tag));
|
||||
}
|
||||
|
||||
|
@ -120,7 +121,7 @@ public class ProcessingRecipeBuilder<T extends ProcessingRecipe<?>> {
|
|||
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));
|
||||
}
|
||||
|
||||
|
|
|
@ -165,7 +165,7 @@ public class BlazeBurnerTileEntity extends SmartTileEntity {
|
|||
protected void read(CompoundNBT compound, boolean clientPacket) {
|
||||
activeFuel = FuelType.values()[compound.getInt("fuelLevel")];
|
||||
remainingBurnTime = compound.getInt("burnTimeRemaining");
|
||||
super.read(compound, clientPacket);
|
||||
super.fromTag(compound, clientPacket);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -81,7 +81,7 @@ public class BeltObserverTileEntity extends SmartTileEntity {
|
|||
@Override
|
||||
protected void read(CompoundNBT compound, boolean clientPacket) {
|
||||
turnOffTicks = compound.getInt("TurnOff");
|
||||
super.read(compound, clientPacket);
|
||||
super.fromTag(compound, clientPacket);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ public class BeltTunnelTileEntity extends SmartTileEntity {
|
|||
.target(0)
|
||||
.withSpeed(.05f));
|
||||
|
||||
super.read(compound, clientPacket);
|
||||
super.fromTag(compound, clientPacket);
|
||||
|
||||
if (!clientPacket)
|
||||
return;
|
||||
|
|
|
@ -476,7 +476,7 @@ public class ChuteTileEntity extends SmartTileEntity implements IHaveGoggleInfor
|
|||
pull = compound.getFloat("Pull");
|
||||
push = compound.getFloat("Push");
|
||||
bottomPullDistance = compound.getFloat("BottomAirFlowDistance");
|
||||
super.read(compound, clientPacket);
|
||||
super.fromTag(compound, clientPacket);
|
||||
|
||||
if (hasWorld() && world.isRemote && !previousItem.equals(item, false) && !item.isEmpty()) {
|
||||
if (world.rand.nextInt(3) != 0)
|
||||
|
|
|
@ -110,7 +110,7 @@ public class DepotTileEntity extends SmartTileEntity {
|
|||
if (compound.contains("HeldItem"))
|
||||
heldItem = TransportedItemStack.read(compound.getCompound("HeldItem"));
|
||||
processingOutputBuffer.deserializeNBT(compound.getCompound("OutputBuffer"));
|
||||
super.read(compound, clientPacket);
|
||||
super.fromTag(compound, clientPacket);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -46,7 +46,7 @@ public class AdjustableRepeaterTileEntity extends SmartTileEntity {
|
|||
protected void read(CompoundNBT compound, boolean clientPacket) {
|
||||
state = compound.getInt("State");
|
||||
charging = compound.getBoolean("Charging");
|
||||
super.read(compound, clientPacket);
|
||||
super.fromTag(compound, clientPacket);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -241,7 +241,7 @@ public class FunnelTileEntity extends SmartTileEntity {
|
|||
|
||||
@Override
|
||||
protected void read(CompoundNBT compound, boolean clientPacket) {
|
||||
super.read(compound, clientPacket);
|
||||
super.fromTag(compound, clientPacket);
|
||||
extractionCooldown = compound.getInt("TransferCooldown");
|
||||
if (clientPacket && compound.contains("Flap")) {
|
||||
int direction = compound.getInt("Flap");
|
||||
|
|
|
@ -153,7 +153,7 @@ public class AdjustableCrateTileEntity extends CrateTileEntity implements INamed
|
|||
protected void read(CompoundNBT compound, boolean clientPacket) {
|
||||
allowedAmount = compound.getInt("AllowedAmount");
|
||||
inventory.deserializeNBT(compound.getCompound("Inventory"));
|
||||
super.read(compound, clientPacket);
|
||||
super.fromTag(compound, clientPacket);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -35,7 +35,7 @@ public class AnalogLeverTileEntity extends SmartTileEntity implements IHaveGoggl
|
|||
state = compound.getInt("State");
|
||||
lastChange = compound.getInt("ChangeTimer");
|
||||
clientState.target(state);
|
||||
super.read(compound, clientPacket);
|
||||
super.fromTag(compound, clientPacket);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -75,7 +75,7 @@ public class RedstoneLinkTileEntity extends SmartTileEntity {
|
|||
@Override
|
||||
protected void read(CompoundNBT compound, boolean clientPacket) {
|
||||
transmitter = compound.getBoolean("Transmitter");
|
||||
super.read(compound, clientPacket);
|
||||
super.fromTag(compound, clientPacket);
|
||||
|
||||
receivedSignal = compound.getInt("Receive");
|
||||
receivedSignalChanged = compound.getBoolean("ReceivedChanged");
|
||||
|
|
|
@ -42,7 +42,7 @@ public class StockpileSwitchTileEntity extends SmartTileEntity {
|
|||
currentLevel = compound.getFloat("Current");
|
||||
powered = compound.getBoolean("Powered");
|
||||
|
||||
super.read(compound, clientPacket);
|
||||
super.fromTag(compound, clientPacket);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -196,7 +196,7 @@ public class SchematicannonTileEntity extends SmartTileEntity implements INamedC
|
|||
if (compound.contains("FlyingBlocks"))
|
||||
readFlyingBlocks(compound);
|
||||
|
||||
super.read(compound, clientPacket);
|
||||
super.fromTag(compound, clientPacket);
|
||||
}
|
||||
|
||||
protected void readFlyingBlocks(CompoundNBT compound) {
|
||||
|
|
|
@ -13,6 +13,7 @@ import com.simibubi.create.Create;
|
|||
import net.minecraft.advancements.ICriterionTrigger;
|
||||
import net.minecraft.advancements.PlayerAdvancements;
|
||||
import net.minecraft.advancements.criterion.CriterionInstance;
|
||||
import net.minecraft.advancements.criterion.EntityPredicate;
|
||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
|
@ -73,8 +74,8 @@ public abstract class CriterionTriggerBase<T extends CriterionTriggerBase.Instan
|
|||
|
||||
protected abstract static class Instance extends CriterionInstance {
|
||||
|
||||
public Instance(ResourceLocation idIn) {
|
||||
super(idIn);
|
||||
public Instance(ResourceLocation idIn, EntityPredicate.AndPredicate p_i231464_2_) {
|
||||
super(idIn, p_i231464_2_);
|
||||
}
|
||||
|
||||
protected abstract boolean test(List<Supplier<Object>> suppliers);
|
||||
|
|
|
@ -92,7 +92,7 @@ public class CTModel extends BakedModelWrapper<IBakedModel> {
|
|||
continue;
|
||||
|
||||
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;
|
||||
int[] vertexData = newQuad.getVertexData();
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ public class ColoredVertexModel extends BakedModelWrapper<IBakedModel> {
|
|||
for (int i = 0; i < quads.size(); i++) {
|
||||
BakedQuad quad = quads.get(i);
|
||||
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;
|
||||
int[] vertexData = newQuad.getVertexData();
|
||||
|
|
|
@ -5,6 +5,7 @@ import com.simibubi.create.foundation.item.PartialItemModelRenderer;
|
|||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.client.renderer.model.ItemCameraTransforms;
|
||||
import net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
|
@ -12,7 +13,7 @@ public class CustomRenderedItemModelRenderer<M extends CustomRenderedItemModel>
|
|||
|
||||
@Override
|
||||
@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()
|
||||
.getItemRenderer()
|
||||
.getItemModelWithOverrides(stack, null, null));
|
||||
|
|
|
@ -42,11 +42,11 @@ public class KillTPSCommand {
|
|||
}
|
||||
|
||||
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 -> {
|
||||
// killtps start tickTime
|
||||
int tickTime = IntegerArgumentType.getInteger(ctx,
|
||||
Lang.translate("command.killTPSCommand.argument.tickTime"));
|
||||
Lang.translate("command.killTPSCommand.argument.tickTime").getUnformattedComponentText());
|
||||
Create.lagger.setTickTime(tickTime);
|
||||
Create.lagger.setLagging(true);
|
||||
ctx.getSource().sendFeedback((Lang.createTranslationTextComponent(
|
||||
|
|
|
@ -13,7 +13,7 @@ import net.minecraft.data.DataGenerator;
|
|||
import net.minecraft.data.IFinishedRecipe;
|
||||
import net.minecraft.data.RecipeProvider;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.tags.Tag;
|
||||
import net.minecraft.tags.ITag;
|
||||
import net.minecraft.util.IItemProvider;
|
||||
import net.minecraftforge.common.Tags;
|
||||
|
||||
|
@ -46,19 +46,19 @@ public abstract class CreateRecipeProvider extends RecipeProvider {
|
|||
|
||||
protected static class I {
|
||||
|
||||
static Tag<Item> redstone() {
|
||||
static ITag.INamedTag<Item> redstone() {
|
||||
return Tags.Items.DUSTS_REDSTONE;
|
||||
}
|
||||
|
||||
static Tag<Item> gold() {
|
||||
static ITag.INamedTag<Item> gold() {
|
||||
return AllTags.forgeItemTag("ingots/gold");
|
||||
}
|
||||
|
||||
static Tag<Item> goldSheet() {
|
||||
static ITag.INamedTag<Item> goldSheet() {
|
||||
return AllTags.forgeItemTag("plates/gold");
|
||||
}
|
||||
|
||||
static Tag<Item> stone() {
|
||||
static ITag.INamedTag<Item> stone() {
|
||||
return Tags.Items.STONE;
|
||||
}
|
||||
|
||||
|
@ -78,23 +78,23 @@ public abstract class CreateRecipeProvider extends RecipeProvider {
|
|||
return AllBlocks.ANDESITE_CASING.get();
|
||||
}
|
||||
|
||||
static Tag<Item> brass() {
|
||||
static ITag.INamedTag<Item> brass() {
|
||||
return AllTags.forgeItemTag("ingots/brass");
|
||||
}
|
||||
|
||||
static Tag<Item> brassSheet() {
|
||||
static ITag.INamedTag<Item> brassSheet() {
|
||||
return AllTags.forgeItemTag("plates/brass");
|
||||
}
|
||||
|
||||
static Tag<Item> iron() {
|
||||
static ITag.INamedTag<Item> iron() {
|
||||
return Tags.Items.INGOTS_IRON;
|
||||
}
|
||||
|
||||
static Tag<Item> zinc() {
|
||||
static ITag.INamedTag<Item> zinc() {
|
||||
return AllTags.forgeItemTag("ingots/zinc");
|
||||
}
|
||||
|
||||
static Tag<Item> ironSheet() {
|
||||
static ITag.INamedTag<Item> ironSheet() {
|
||||
return AllTags.forgeItemTag("plates/iron");
|
||||
}
|
||||
|
||||
|
@ -110,35 +110,35 @@ public abstract class CreateRecipeProvider extends RecipeProvider {
|
|||
return AllItems.INTEGRATED_CIRCUIT.get();
|
||||
}
|
||||
|
||||
static Tag<Item> copperBlock() {
|
||||
static ITag.INamedTag<Item> copperBlock() {
|
||||
return AllTags.forgeItemTag("storage_blocks/copper");
|
||||
}
|
||||
|
||||
static Tag<Item> brassBlock() {
|
||||
static ITag.INamedTag<Item> brassBlock() {
|
||||
return AllTags.forgeItemTag("storage_blocks/brass");
|
||||
}
|
||||
|
||||
static Tag<Item> zincBlock() {
|
||||
static ITag.INamedTag<Item> zincBlock() {
|
||||
return AllTags.forgeItemTag("storage_blocks/zinc");
|
||||
}
|
||||
|
||||
static Tag<Item> copper() {
|
||||
static ITag.INamedTag<Item> copper() {
|
||||
return AllTags.forgeItemTag("ingots/copper");
|
||||
}
|
||||
|
||||
static Tag<Item> copperSheet() {
|
||||
static ITag.INamedTag<Item> copperSheet() {
|
||||
return AllTags.forgeItemTag("plates/copper");
|
||||
}
|
||||
|
||||
static Tag<Item> copperNugget() {
|
||||
static ITag.INamedTag<Item> copperNugget() {
|
||||
return AllTags.forgeItemTag("nuggets/copper");
|
||||
}
|
||||
|
||||
static Tag<Item> brassNugget() {
|
||||
static ITag.INamedTag<Item> brassNugget() {
|
||||
return AllTags.forgeItemTag("nuggets/brass");
|
||||
}
|
||||
|
||||
static Tag<Item> zincNugget() {
|
||||
static ITag.INamedTag<Item> zincNugget() {
|
||||
return AllTags.forgeItemTag("nuggets/zinc");
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ import net.minecraft.fluid.Fluid;
|
|||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.tags.FluidTags;
|
||||
import net.minecraft.tags.ITag;
|
||||
import net.minecraft.tags.Tag;
|
||||
import net.minecraft.util.JSONUtils;
|
||||
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 FluidIngredient fromTag(Tag<Fluid> tag, int amount) {
|
||||
public static FluidIngredient fromTag(ITag.INamedTag<Fluid> tag, int amount) {
|
||||
FluidTagIngredient ingredient = new FluidTagIngredient();
|
||||
ingredient.tag = tag;
|
||||
ingredient.amountRequired = amount;
|
||||
|
@ -158,7 +159,7 @@ public abstract class FluidIngredient implements Predicate<FluidStack> {
|
|||
|
||||
public static class FluidTagIngredient extends FluidIngredient {
|
||||
|
||||
protected Tag<Fluid> tag;
|
||||
protected ITag.INamedTag<Fluid> tag;
|
||||
|
||||
@Override
|
||||
protected boolean testInternal(FluidStack t) {
|
||||
|
@ -169,7 +170,7 @@ public abstract class FluidIngredient implements Predicate<FluidStack> {
|
|||
@Override
|
||||
protected void readInternal(PacketBuffer buffer) {
|
||||
ResourceLocation resourcelocation = buffer.readResourceLocation();
|
||||
tag = FluidTags.getContainer()
|
||||
tag = FluidTags.func_226157_a_()
|
||||
.get(resourcelocation);
|
||||
}
|
||||
|
||||
|
@ -181,7 +182,7 @@ public abstract class FluidIngredient implements Predicate<FluidStack> {
|
|||
@Override
|
||||
protected void readInternal(JsonObject json) {
|
||||
ResourceLocation id = new ResourceLocation(JSONUtils.getString(json, "fluidTag"));
|
||||
tag = FluidTags.getContainer()
|
||||
tag = FluidTags.func_226157_a_()
|
||||
.get(id);
|
||||
if (tag == null)
|
||||
throw new JsonSyntaxException("Unknown fluid tag '" + id + "'");
|
||||
|
|
|
@ -14,7 +14,7 @@ public class WipScription extends ItemDescription {
|
|||
|
||||
public WipScription(Palette palette) {
|
||||
super(palette);
|
||||
add(getLines(), TextFormatting.RED + Lang.translate("tooltip.workInProgress"));
|
||||
add(getLines(), Lang.translate("tooltip.workInProgress").formatted(TextFormatting.RED));
|
||||
|
||||
int descriptions = 0;
|
||||
while (I18n.hasKey("create.tooltip.randomWipDescription" + descriptions++))
|
||||
|
@ -22,7 +22,7 @@ public class WipScription extends ItemDescription {
|
|||
|
||||
if (--descriptions > 0) {
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ import java.util.function.Consumer;
|
|||
|
||||
import com.simibubi.create.foundation.tileEntity.behaviour.BehaviourType;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.tileentity.ITickableTileEntity;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
|
@ -75,26 +76,26 @@ public abstract class SmartTileEntity extends SyncedTileEntity implements ITicka
|
|||
}
|
||||
|
||||
@Override
|
||||
public final void readClientUpdate(CompoundNBT tag) {
|
||||
read(tag, true);
|
||||
public final void readClientUpdate(BlockState state, CompoundNBT tag) {
|
||||
fromTag(state, tag, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void read(CompoundNBT tag) {
|
||||
read(tag, false);
|
||||
public final void fromTag(BlockState state, CompoundNBT tag) {
|
||||
fromTag(state, tag, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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) {
|
||||
firstNbtRead = false;
|
||||
ArrayList<TileEntityBehaviour> list = new ArrayList<>();
|
||||
addBehavioursDeferred(list);
|
||||
list.forEach(b -> behaviours.put(b.getType(), b));
|
||||
}
|
||||
super.read(compound);
|
||||
super.fromTag(state, compound);
|
||||
behaviours.values()
|
||||
.forEach(tb -> tb.read(compound, clientPacket));
|
||||
}
|
||||
|
|
|
@ -18,13 +18,15 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
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 ValueBox extends ChasingAABBOutline {
|
||||
|
||||
protected ITextComponent label = ITextComponent.of("Value Box");
|
||||
protected ITextComponent sublabel = ITextComponent.of("");
|
||||
protected String scrollTooltip = "";
|
||||
protected ITextComponent scrollTooltip = StringTextComponent.EMPTY;
|
||||
protected Vector3d labelOffset = Vector3d.ZERO;
|
||||
|
||||
protected int passiveColor;
|
||||
|
@ -57,7 +59,7 @@ public class ValueBox extends ChasingAABBOutline {
|
|||
return this;
|
||||
}
|
||||
|
||||
public ValueBox scrollTooltip(String scrollTip) {
|
||||
public ValueBox scrollTooltip(ITextComponent scrollTip) {
|
||||
this.scrollTooltip = scrollTip;
|
||||
return this;
|
||||
}
|
||||
|
@ -108,7 +110,7 @@ public class ValueBox extends ChasingAABBOutline {
|
|||
ms.translate(0, 10, 0);
|
||||
renderHoveringText(ms, buffer, sublabel);
|
||||
}
|
||||
if (!scrollTooltip.isEmpty()) {
|
||||
if (!scrollTooltip.getUnformattedComponentText().isEmpty()) {
|
||||
ms.translate(0, 10, 0);
|
||||
renderHoveringText(ms, buffer, scrollTooltip, 0x998899, 0x111111);
|
||||
}
|
||||
|
@ -125,7 +127,7 @@ public class ValueBox extends ChasingAABBOutline {
|
|||
ItemStack stack;
|
||||
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);
|
||||
this.stack = stack;
|
||||
this.count = count;
|
||||
|
@ -135,13 +137,13 @@ public class ValueBox extends ChasingAABBOutline {
|
|||
public void renderContents(MatrixStack ms, IRenderTypeBuffer buffer) {
|
||||
super.renderContents(ms, buffer);
|
||||
FontRenderer font = Minecraft.getInstance().fontRenderer;
|
||||
String countString = count == 0 ? "*" : count + "";
|
||||
ITextComponent countString = ITextComponent.of(count == 0 ? "*" : count + "");
|
||||
ms.translate(17.5f, -5f, 7f);
|
||||
|
||||
boolean isFilter = stack.getItem() instanceof FilterItem;
|
||||
boolean isEmpty = stack.isEmpty();
|
||||
float scale = 1.5f;
|
||||
ms.translate(-font.getStringWidth(countString), 0, 0);
|
||||
ms.translate(-font.getWidth(countString), 0, 0);
|
||||
|
||||
if (isFilter)
|
||||
ms.translate(3, 8, 7.25f);
|
||||
|
@ -194,7 +196,7 @@ public class ValueBox extends ChasingAABBOutline {
|
|||
public static class IconValueBox extends ValueBox {
|
||||
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);
|
||||
subLabel(Lang.translate(iconValue.getTranslationKey()));
|
||||
icon = iconValue.getIcon();
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.simibubi.create.foundation.tileEntity.behaviour;
|
|||
|
||||
import java.util.function.Function;
|
||||
|
||||
import com.simibubi.create.foundation.utility.BlockHelper;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
|
@ -46,9 +47,9 @@ public abstract class ValueBoxTransform {
|
|||
|
||||
protected Vector3d rotateHorizontally(BlockState state, Vector3d vec) {
|
||||
float yRot = 0;
|
||||
if (state.has(BlockStateProperties.FACING))
|
||||
if (BlockHelper.hasBlockStateProperty(state, 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));
|
||||
return VecHelper.rotateCentered(vec, yRot, Axis.Y);
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
|
||||
import com.simibubi.create.foundation.utility.BlockHelper;
|
||||
import com.simibubi.create.foundation.utility.RaycastHelper;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
|
@ -61,14 +62,14 @@ public class EdgeInteractionHandler {
|
|||
public static List<Direction> getConnectiveSides(World world, BlockPos pos, Direction face,
|
||||
EdgeInteractionBehaviour behaviour) {
|
||||
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;
|
||||
|
||||
for (Direction direction : Direction.values()) {
|
||||
if (direction.getAxis() == face.getAxis())
|
||||
continue;
|
||||
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()))
|
||||
continue;
|
||||
if (!behaviour.connectivityPredicate.test(world, pos, face, direction))
|
||||
|
|
|
@ -19,6 +19,7 @@ import net.minecraft.util.math.BlockPos;
|
|||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
|
||||
public class EdgeInteractionRenderer {
|
||||
|
||||
|
@ -63,7 +64,7 @@ public class EdgeInteractionRenderer {
|
|||
AxisAlignedBB bb = EdgeInteractionHandler.getBB(pos, closestEdge);
|
||||
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;
|
||||
|
||||
boolean positive = closestEdge.getAxisDirection() == AxisDirection.POSITIVE;
|
||||
|
|
|
@ -26,6 +26,9 @@ import net.minecraft.util.math.BlockPos;
|
|||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
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 {
|
||||
|
||||
|
@ -60,7 +63,7 @@ public class FilteringRenderer {
|
|||
ItemStack filter = behaviour.getFilter();
|
||||
boolean isFilterSlotted = filter.getItem() instanceof FilterItem;
|
||||
boolean showCount = behaviour.isCountVisible();
|
||||
String label = isFilterSlotted ? ""
|
||||
ITextComponent label = isFilterSlotted ? StringTextComponent.EMPTY
|
||||
: Lang.translate(behaviour.recipeFilter ? "logistics.recipe_filter" : "logistics.filter");
|
||||
boolean hit = behaviour.slotPositioning.testHit(state, target.getHitVec()
|
||||
.subtract(Vector3d.of(pos)));
|
||||
|
@ -73,7 +76,7 @@ public class FilteringRenderer {
|
|||
|
||||
box.offsetLabel(behaviour.textShift)
|
||||
.withColors(0x7A6A2C, 0xB79D64)
|
||||
.scrollTooltip(showCount ? "[" + Lang.translate("action.scroll") + "]" : "")
|
||||
.scrollTooltip(ITextComponent.of(showCount ? "[" + Lang.translate("action.scroll").getUnformattedComponentText() + "]" : ""))
|
||||
.passive(!hit);
|
||||
|
||||
CreateClient.outliner.showValueBox(Pair.of("filter", pos), box.transform(behaviour.slotPositioning))
|
||||
|
|
|
@ -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.utility.BlockFace;
|
||||
|
||||
import com.simibubi.create.foundation.utility.BlockHelper;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.state.properties.BlockStateProperties;
|
||||
|
@ -173,13 +174,13 @@ public class InvManipulationBehaviour extends TileEntityBehaviour {
|
|||
public interface InterfaceProvider {
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
public static InterfaceProvider oppositeOfBlockFacing() {
|
||||
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());
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ import net.minecraft.util.math.BlockPos;
|
|||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
|
||||
public class LinkRenderer {
|
||||
|
||||
|
@ -38,12 +39,12 @@ public class LinkRenderer {
|
|||
if (behaviour == null)
|
||||
return;
|
||||
|
||||
String freq1 = Lang.translate("logistics.firstFrequency");
|
||||
String freq2 = Lang.translate("logistics.secondFrequency");
|
||||
ITextComponent freq1 = Lang.translate("logistics.firstFrequency");
|
||||
ITextComponent freq2 = Lang.translate("logistics.secondFrequency");
|
||||
|
||||
for (boolean first : Iterate.trueAndFalse) {
|
||||
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());
|
||||
ValueBoxTransform transform = first ? behaviour.firstSlot : behaviour.secondSlot;
|
||||
|
||||
|
|
|
@ -5,13 +5,14 @@ import java.util.function.Function;
|
|||
|
||||
import com.simibubi.create.foundation.tileEntity.SmartTileEntity;
|
||||
import com.simibubi.create.foundation.tileEntity.behaviour.ValueBoxTransform;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
|
||||
public class BulkScrollValueBehaviour extends ScrollValueBehaviour {
|
||||
|
||||
Function<SmartTileEntity, List<? extends SmartTileEntity>> groupGetter;
|
||||
|
||||
public BulkScrollValueBehaviour(String label, SmartTileEntity te, ValueBoxTransform slot,
|
||||
Function<SmartTileEntity, List<? extends SmartTileEntity>> groupGetter) {
|
||||
public BulkScrollValueBehaviour(ITextComponent label, SmartTileEntity te, ValueBoxTransform slot,
|
||||
Function<SmartTileEntity, List<? extends SmartTileEntity>> groupGetter) {
|
||||
super(label, te, slot);
|
||||
this.groupGetter = groupGetter;
|
||||
}
|
||||
|
|
|
@ -64,10 +64,10 @@ public class ScrollValueRenderer {
|
|||
} else {
|
||||
box = new TextValueBox(label, bb, pos, behaviour.formatValue());
|
||||
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))
|
||||
.withColors(0x5A5D5A, 0xB5B7B6)
|
||||
.passive(!highlight);
|
||||
|
|
|
@ -47,7 +47,7 @@ public class DyeHelper {
|
|||
}
|
||||
}
|
||||
|
||||
public static Tag<Item> getTagOfDye(DyeColor color) {
|
||||
public static Tags.IOptionalNamedTag<Item> getTagOfDye(DyeColor color) {
|
||||
switch (color) {
|
||||
case BLACK:
|
||||
return Tags.Items.DYES_BLACK;
|
||||
|
|
|
@ -208,7 +208,7 @@ public class TreeCutter {
|
|||
}
|
||||
|
||||
private static boolean isLeaf(BlockState state) {
|
||||
return state.has(LeavesBlock.DISTANCE);
|
||||
return BlockHelper.hasBlockStateProperty(state, LeavesBlock.DISTANCE);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -7,8 +7,6 @@ import java.util.function.Function;
|
|||
|
||||
import org.apache.commons.lang3.mutable.MutableObject;
|
||||
|
||||
import com.simibubi.create.content.contraptions.relays.belt.Vector3i;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Direction.Axis;
|
||||
|
|
|
@ -54,7 +54,7 @@ public enum AllWorldFeatures {
|
|||
for (AllWorldFeatures entry : AllWorldFeatures.values()) {
|
||||
for (Biome biome : ForgeRegistries.BIOMES) {
|
||||
|
||||
if (biome == Biomes.THE_VOID)
|
||||
if (biome.getRegistryName() == Biomes.THE_VOID.getRegistryName())
|
||||
continue;
|
||||
if (biome == Biomes.NETHER)
|
||||
continue;
|
||||
|
|
|
@ -66,7 +66,7 @@ public abstract class OreFeature<T extends IPlacementConfig> extends ConfigBase
|
|||
|
||||
Pair<Placement<T>, T> placement = getPlacement();
|
||||
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()))
|
||||
.createDecoratedFeature(placement.getKey()
|
||||
.configure(placement.getValue()));
|
||||
|
|
|
@ -54,7 +54,7 @@ public class OxidizingBlock extends Block {
|
|||
if (!worldIn.isBlockPresent(neighbourPos))
|
||||
continue;
|
||||
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));
|
||||
}
|
||||
if (BlockHelper.hasBlockSolidSide(neighborState, worldIn, neighbourPos, facing.getOpposite())) {
|
||||
|
|
Loading…
Reference in a new issue