SmarterTileEntity

- Clean up SyncedTileEntity and SmartTileEntity
- Allow schematicannons to be rotated based on placement angle
- Fix DirectionalExtenderScrollOptionSlot rotation
- Remove deprecated usage of JsonReader and LazyLoadedValue
- Move ToolSelectionScreen to content.schematics.client
- Organize imports
- Update to 1.18.1
This commit is contained in:
PepperBell 2021-12-10 16:58:05 -08:00
parent 8101f19611
commit 080b048b2f
130 changed files with 428 additions and 465 deletions

View file

@ -168,8 +168,8 @@ dependencies {
implementation fg.deobf("com.jozufozu.flywheel:Flywheel-Forge:${flywheel_version}")
}
compileOnly fg.deobf("mezz.jei:jei-${minecraft_version}:${jei_version}:api")
runtimeOnly fg.deobf("mezz.jei:jei-${minecraft_version}:${jei_version}")
compileOnly fg.deobf("mezz.jei:jei-${jei_minecraft_version}:${jei_version}:api")
runtimeOnly fg.deobf("mezz.jei:jei-${jei_minecraft_version}:${jei_version}")
// implementation fg.deobf("curse.maven:druidcraft-340991:3101903")
// implementation fg.deobf("com.ferreusveritas.dynamictrees:DynamicTrees-1.16.5:0.10.0-Beta25")

View file

@ -5,8 +5,8 @@ org.gradle.daemon = false
# mod version info
mod_version = 0.4
minecraft_version = 1.18
forge_version = 38.0.15
minecraft_version = 1.18.1
forge_version = 39.0.0
# build dependency versions
forgegradle_version = 5.1.+
@ -19,7 +19,8 @@ parchment_version = 2021.10.31
# dependency versions
registrate_version = MC1.18-1.0.21
flywheel_version = 1.18-0.4.0.11
flywheel_version = 1.18-0.4.0.15
jei_minecraft_version = 1.18
jei_version = 9.0.0.40
# curseforge information

View file

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

View file

@ -11,18 +11,18 @@ import net.minecraft.world.level.block.state.BlockState;
import net.minecraftforge.eventbus.api.GenericEvent;
/**
* Event that is fired just before a SmartTileEntity is being deserealized <br>
* Event that is fired just before a SmartTileEntity is being deserialized<br>
* Also if a new one is placed<br>
* Use it to attach a new {@link TileEntityBehaviour} or replace existing ones
* (with caution) <br>
* (with caution)<br>
* <br>
* Actual setup of the behaviours internal workings and data should be done in
* TileEntityBehaviour#read() and TileEntityBehaviour#initialize()
* respectively.<br>
* <br>
* Because of the earlyness of this event, the added behaviours will have access
* to the initial nbt read (unless the TE was placed, not loaded), thereby
* allowing tiles to store and retrieve data for injected behaviours
* Because of the earliness of this event, the added behaviours will have access
* to the initial NBT read (unless the TE was placed, not loaded), thereby
* allowing tiles to store and retrieve data for injected behaviours.
*/
public class TileEntityBehaviourEvent<T extends SmartTileEntity> extends GenericEvent<T> {

View file

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

View file

@ -1,8 +1,8 @@
package com.simibubi.create.content.contraptions.base;
import com.jozufozu.flywheel.backend.instancing.tile.TileEntityInstance;
import com.jozufozu.flywheel.api.Material;
import com.jozufozu.flywheel.api.MaterialManager;
import com.jozufozu.flywheel.backend.instancing.tile.TileEntityInstance;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.content.contraptions.base.flwdata.RotatingData;
import com.simibubi.create.content.contraptions.relays.elementary.ICogWheel;

View file

@ -1,11 +1,11 @@
package com.simibubi.create.content.contraptions.base.flwdata;
import com.jozufozu.flywheel.backend.gl.attrib.VertexFormat;
import com.jozufozu.flywheel.backend.gl.buffer.VecBuffer;
import com.jozufozu.flywheel.api.struct.Batched;
import com.jozufozu.flywheel.api.struct.BatchingTransformer;
import com.jozufozu.flywheel.api.struct.StructWriter;
import com.jozufozu.flywheel.api.struct.Instanced;
import com.jozufozu.flywheel.api.struct.StructWriter;
import com.jozufozu.flywheel.backend.gl.attrib.VertexFormat;
import com.jozufozu.flywheel.backend.gl.buffer.VecBuffer;
import com.jozufozu.flywheel.core.model.Model;
import com.simibubi.create.foundation.render.AllInstanceFormats;
import com.simibubi.create.foundation.render.AllProgramSpecs;

View file

@ -1,11 +1,11 @@
package com.simibubi.create.content.contraptions.base.flwdata;
import com.jozufozu.flywheel.backend.gl.attrib.VertexFormat;
import com.jozufozu.flywheel.backend.gl.buffer.VecBuffer;
import com.jozufozu.flywheel.api.struct.Batched;
import com.jozufozu.flywheel.api.struct.BatchingTransformer;
import com.jozufozu.flywheel.api.struct.StructWriter;
import com.jozufozu.flywheel.api.struct.Instanced;
import com.jozufozu.flywheel.api.struct.StructWriter;
import com.jozufozu.flywheel.backend.gl.attrib.VertexFormat;
import com.jozufozu.flywheel.backend.gl.buffer.VecBuffer;
import com.jozufozu.flywheel.core.model.Model;
import com.simibubi.create.foundation.render.AllInstanceFormats;
import com.simibubi.create.foundation.render.AllProgramSpecs;

View file

@ -2,8 +2,8 @@ package com.simibubi.create.content.contraptions.base.flwdata;
import org.lwjgl.system.MemoryUtil;
import com.jozufozu.flywheel.backend.gl.buffer.VecBuffer;
import com.jozufozu.flywheel.api.struct.StructType;
import com.jozufozu.flywheel.backend.gl.buffer.VecBuffer;
import com.jozufozu.flywheel.backend.struct.UnsafeBufferWriter;
public class UnsafeBeltWriter extends UnsafeBufferWriter<BeltData> {

View file

@ -2,8 +2,8 @@ package com.simibubi.create.content.contraptions.base.flwdata;
import org.lwjgl.system.MemoryUtil;
import com.jozufozu.flywheel.backend.gl.buffer.VecBuffer;
import com.jozufozu.flywheel.api.struct.StructType;
import com.jozufozu.flywheel.backend.gl.buffer.VecBuffer;
import com.jozufozu.flywheel.backend.struct.UnsafeBufferWriter;
public class UnsafeRotatingWriter extends UnsafeBufferWriter<RotatingData> {

View file

@ -68,12 +68,12 @@ public abstract class BlockBreakingKineticTileEntity extends KineticTileEntity {
}
@Override
protected void fromTag(CompoundTag compound, boolean clientPacket) {
protected void read(CompoundTag compound, boolean clientPacket) {
destroyProgress = compound.getInt("Progress");
ticksUntilNextProgress = compound.getInt("NextTick");
if (compound.contains("Breaking"))
breakingPos = NbtUtils.readBlockPos(compound.getCompound("Breaking"));
super.fromTag(compound, clientPacket);
super.read(compound, clientPacket);
}
@Override

View file

@ -2,8 +2,8 @@ package com.simibubi.create.content.contraptions.components.actors;
import javax.annotation.Nullable;
import com.jozufozu.flywheel.backend.Backend;
import com.jozufozu.flywheel.api.MaterialManager;
import com.jozufozu.flywheel.backend.Backend;
import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext;
import com.simibubi.create.content.contraptions.components.structureMovement.render.ActorInstance;
import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionMatrices;

View file

@ -4,8 +4,8 @@ import javax.annotation.Nullable;
import org.apache.commons.lang3.mutable.MutableBoolean;
import com.jozufozu.flywheel.backend.Backend;
import com.jozufozu.flywheel.api.MaterialManager;
import com.jozufozu.flywheel.backend.Backend;
import com.simibubi.create.content.contraptions.components.structureMovement.MovementBehaviour;
import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext;
import com.simibubi.create.content.contraptions.components.structureMovement.render.ActorInstance;

View file

@ -86,8 +86,8 @@ public abstract class PortableStorageInterfaceTileEntity extends SmartTileEntity
}
@Override
protected void fromTag(CompoundTag compound, boolean clientPacket) {
super.fromTag(compound, clientPacket);
protected void read(CompoundTag compound, boolean clientPacket) {
super.read(compound, clientPacket);
transferTimer = compound.getInt("Timer");
distance = compound.getFloat("Distance");
powered = compound.getBoolean("Powered");

View file

@ -1,11 +1,11 @@
package com.simibubi.create.content.contraptions.components.actors.flwdata;
import com.jozufozu.flywheel.backend.gl.attrib.VertexFormat;
import com.jozufozu.flywheel.backend.gl.buffer.VecBuffer;
import com.jozufozu.flywheel.api.struct.Batched;
import com.jozufozu.flywheel.api.struct.BatchingTransformer;
import com.jozufozu.flywheel.api.struct.StructWriter;
import com.jozufozu.flywheel.api.struct.Instanced;
import com.jozufozu.flywheel.api.struct.StructWriter;
import com.jozufozu.flywheel.backend.gl.attrib.VertexFormat;
import com.jozufozu.flywheel.backend.gl.buffer.VecBuffer;
import com.jozufozu.flywheel.core.model.Model;
import com.simibubi.create.foundation.render.AllInstanceFormats;
import com.simibubi.create.foundation.render.AllProgramSpecs;

View file

@ -2,8 +2,8 @@ package com.simibubi.create.content.contraptions.components.actors.flwdata;
import org.lwjgl.system.MemoryUtil;
import com.jozufozu.flywheel.backend.gl.buffer.VecBuffer;
import com.jozufozu.flywheel.api.struct.StructType;
import com.jozufozu.flywheel.backend.gl.buffer.VecBuffer;
import com.jozufozu.flywheel.backend.struct.UnsafeBufferWriter;
public class UnsafeActorWriter extends UnsafeBufferWriter<ActorData> {

View file

@ -44,8 +44,8 @@ public class CuckooClockTileEntity extends KineticTileEntity {
}
@Override
protected void fromTag(CompoundTag compound, boolean clientPacket) {
super.fromTag(compound, clientPacket);
protected void read(CompoundTag compound, boolean clientPacket) {
super.read(compound, clientPacket);
if (clientPacket && compound.contains("Animation")) {
animationType = NBTHelper.readEnum(compound, "Animation", Animation.class);
animationProgress.lastValue = 0;

View file

@ -168,7 +168,7 @@ public class MechanicalCrafterTileEntity extends KineticTileEntity {
}
@Override
protected void fromTag(CompoundTag compound, boolean clientPacket) {
protected void read(CompoundTag compound, boolean clientPacket) {
Phase phaseBefore = phase;
GroupedItems before = this.groupedItems;
@ -183,7 +183,7 @@ public class MechanicalCrafterTileEntity extends KineticTileEntity {
this.phase = phase;
countDown = compound.getInt("CountDown");
covered = compound.getBoolean("Cover");
super.fromTag(compound, clientPacket);
super.read(compound, clientPacket);
if (!clientPacket)
return;
if (compound.contains("Redraw"))

View file

@ -1,8 +1,8 @@
package com.simibubi.create.content.contraptions.components.crank;
import com.jozufozu.flywheel.api.instance.IDynamicInstance;
import com.jozufozu.flywheel.api.Instancer;
import com.jozufozu.flywheel.api.MaterialManager;
import com.jozufozu.flywheel.api.instance.IDynamicInstance;
import com.jozufozu.flywheel.core.PartialModel;
import com.jozufozu.flywheel.core.materials.model.ModelData;
import com.simibubi.create.content.contraptions.base.SingleRotatingInstance;

View file

@ -53,9 +53,9 @@ public class HandCrankTileEntity extends GeneratingKineticTileEntity {
}
@Override
protected void fromTag(CompoundTag compound, boolean clientPacket) {
protected void read(CompoundTag compound, boolean clientPacket) {
inUse = compound.getInt("InUse");
super.fromTag(compound, clientPacket);
super.read(compound, clientPacket);
}
@Override

View file

@ -331,8 +331,8 @@ public class CrushingWheelControllerTileEntity extends SmartTileEntity {
}
@Override
protected void fromTag(CompoundTag compound, boolean clientPacket) {
super.fromTag(compound, clientPacket);
protected void read(CompoundTag compound, boolean clientPacket) {
super.read(compound, clientPacket);
if (compound.contains("Entity") && !isOccupied()) {
entityUUID = NbtUtils.loadUUID(NBTHelper.getINBT(compound, "Entity"));
this.searchForEntity = true;

View file

@ -3,9 +3,9 @@ package com.simibubi.create.content.contraptions.components.deployer;
import static com.simibubi.create.content.contraptions.base.DirectionalAxisKineticBlock.AXIS_ALONG_FIRST_COORDINATE;
import static com.simibubi.create.content.contraptions.base.DirectionalKineticBlock.FACING;
import com.jozufozu.flywheel.api.MaterialManager;
import com.jozufozu.flywheel.api.instance.IDynamicInstance;
import com.jozufozu.flywheel.api.instance.ITickableInstance;
import com.jozufozu.flywheel.api.MaterialManager;
import com.jozufozu.flywheel.core.PartialModel;
import com.jozufozu.flywheel.core.materials.oriented.OrientedData;
import com.mojang.math.Quaternion;

View file

@ -7,8 +7,8 @@ import javax.annotation.Nullable;
import org.apache.commons.lang3.tuple.Pair;
import com.jozufozu.flywheel.backend.Backend;
import com.jozufozu.flywheel.api.MaterialManager;
import com.jozufozu.flywheel.backend.Backend;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllItems;
import com.simibubi.create.AllTags.AllBlockTags;

View file

@ -309,7 +309,7 @@ public class DeployerTileEntity extends KineticTileEntity {
}
@Override
protected void fromTag(CompoundTag compound, boolean clientPacket) {
protected void read(CompoundTag compound, boolean clientPacket) {
state = NBTHelper.readEnum(compound, "State", State.class);
mode = NBTHelper.readEnum(compound, "Mode", Mode.class);
timer = compound.getInt("Timer");
@ -319,7 +319,7 @@ public class DeployerTileEntity extends KineticTileEntity {
overflowItems = NBTHelper.readItemList(compound.getList("Overflow", Tag.TAG_COMPOUND));
if (compound.contains("HeldItem"))
heldItem = ItemStack.of(compound.getCompound("HeldItem"));
super.fromTag(compound, clientPacket);
super.read(compound, clientPacket);
if (!clientPacket)
return;

View file

@ -38,8 +38,8 @@ public class EncasedFanTileEntity extends GeneratingKineticTileEntity implements
}
@Override
protected void fromTag(CompoundTag compound, boolean clientPacket) {
super.fromTag(compound, clientPacket);
protected void read(CompoundTag compound, boolean clientPacket) {
super.read(compound, clientPacket);
if (!wasMoved)
isGenerator = compound.getBoolean("Generating");
if (clientPacket)

View file

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

View file

@ -6,11 +6,11 @@ import java.util.Collections;
import java.util.List;
import com.google.common.collect.Lists;
import com.jozufozu.flywheel.api.instance.IDynamicInstance;
import com.jozufozu.flywheel.api.InstanceData;
import com.jozufozu.flywheel.api.Instancer;
import com.jozufozu.flywheel.api.Material;
import com.jozufozu.flywheel.api.MaterialManager;
import com.jozufozu.flywheel.api.instance.IDynamicInstance;
import com.jozufozu.flywheel.core.materials.model.ModelData;
import com.jozufozu.flywheel.util.transform.TransformStack;
import com.mojang.blaze3d.vertex.PoseStack;

View file

@ -63,11 +63,11 @@ public class FlywheelTileEntity extends GeneratingKineticTileEntity {
}
@Override
protected void fromTag(CompoundTag compound, boolean clientPacket) {
protected void read(CompoundTag compound, boolean clientPacket) {
generatedSpeed = compound.getFloat("GeneratedSpeed");
generatedCapacity = compound.getFloat("GeneratedCapacity");
stoppingCooldown = compound.getInt("Cooldown");
super.fromTag(compound, clientPacket);
super.read(compound, clientPacket);
if (clientPacket)
visualSpeed.withSpeed(1 / 32f)
.target(getGeneratedSpeed());

View file

@ -1,7 +1,7 @@
package com.simibubi.create.content.contraptions.components.flywheel.engine;
import com.jozufozu.flywheel.backend.instancing.tile.TileEntityInstance;
import com.jozufozu.flywheel.api.MaterialManager;
import com.jozufozu.flywheel.backend.instancing.tile.TileEntityInstance;
import com.jozufozu.flywheel.core.PartialModel;
import com.jozufozu.flywheel.core.materials.model.ModelData;
import com.simibubi.create.foundation.utility.AngleHelper;

View file

@ -163,11 +163,11 @@ public class MillstoneTileEntity extends KineticTileEntity {
}
@Override
protected void fromTag(CompoundTag compound, boolean clientPacket) {
protected void read(CompoundTag compound, boolean clientPacket) {
timer = compound.getInt("Timer");
inputInv.deserializeNBT(compound.getCompound("InputInventory"));
outputInv.deserializeNBT(compound.getCompound("OutputInventory"));
super.fromTag(compound, clientPacket);
super.read(compound, clientPacket);
}
public int getProcessingSpeed() {

View file

@ -96,10 +96,10 @@ public class MechanicalMixerTileEntity extends BasinOperatingTileEntity {
}
@Override
protected void fromTag(CompoundTag compound, boolean clientPacket) {
protected void read(CompoundTag compound, boolean clientPacket) {
running = compound.getBoolean("Running");
runningTicks = compound.getInt("Ticks");
super.fromTag(compound, clientPacket);
super.read(compound, clientPacket);
if (clientPacket && hasLevel())
getBasin().ifPresent(bte -> bte.setAreFluidsMoving(running && runningTicks <= 20));

View file

@ -1,8 +1,8 @@
package com.simibubi.create.content.contraptions.components.mixer;
import com.jozufozu.flywheel.api.instance.IDynamicInstance;
import com.jozufozu.flywheel.api.Instancer;
import com.jozufozu.flywheel.api.MaterialManager;
import com.jozufozu.flywheel.api.instance.IDynamicInstance;
import com.jozufozu.flywheel.core.materials.oriented.OrientedData;
import com.simibubi.create.AllBlockPartials;
import com.simibubi.create.content.contraptions.base.flwdata.RotatingData;

View file

@ -82,12 +82,12 @@ public class MechanicalPressTileEntity extends BasinOperatingTileEntity {
}
@Override
protected void fromTag(CompoundTag compound, boolean clientPacket) {
protected void read(CompoundTag compound, boolean clientPacket) {
running = compound.getBoolean("Running");
mode = Mode.values()[compound.getInt("Mode")];
finished = compound.getBoolean("Finished");
prevRunningTicks = runningTicks = compound.getInt("Ticks");
super.fromTag(compound, clientPacket);
super.read(compound, clientPacket);
if (clientPacket) {
NBTHelper.iterateCompoundList(compound.getList("ParticleItems", Tag.TAG_COMPOUND),

View file

@ -1,7 +1,7 @@
package com.simibubi.create.content.contraptions.components.press;
import com.jozufozu.flywheel.api.instance.IDynamicInstance;
import com.jozufozu.flywheel.api.MaterialManager;
import com.jozufozu.flywheel.api.instance.IDynamicInstance;
import com.jozufozu.flywheel.core.Materials;
import com.jozufozu.flywheel.core.materials.oriented.OrientedData;
import com.mojang.math.Quaternion;

View file

@ -6,10 +6,12 @@ import java.util.List;
import java.util.Optional;
import java.util.Random;
import java.util.function.Predicate;
import java.util.function.Supplier;
import java.util.stream.Collectors;
import javax.annotation.ParametersAreNonnullByDefault;
import com.google.common.base.Suppliers;
import com.google.common.collect.ImmutableList;
import com.simibubi.create.AllRecipeTypes;
import com.simibubi.create.AllSoundEvents;
@ -39,7 +41,6 @@ import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.BlockTags;
import net.minecraft.util.LazyLoadedValue;
import net.minecraft.util.Mth;
import net.minecraft.world.entity.item.ItemEntity;
import net.minecraft.world.item.BlockItem;
@ -75,8 +76,8 @@ public class SawTileEntity extends BlockBreakingKineticTileEntity {
private static final AABB RENDER_BOX = new AABB(0, 0, 0, 1, 1, 1);
private static final Object cuttingRecipesKey = new Object();
public static final LazyLoadedValue<RecipeType<?>> woodcuttingRecipeType =
new LazyLoadedValue<>(() -> Registry.RECIPE_TYPE.get(new ResourceLocation("druidcraft", "woodcutting")));
public static final Supplier<RecipeType<?>> woodcuttingRecipeType =
Suppliers.memoize(() -> Registry.RECIPE_TYPE.get(new ResourceLocation("druidcraft", "woodcutting")));
public ProcessingInventory inventory;
private int recipeIndex;
@ -115,8 +116,8 @@ public class SawTileEntity extends BlockBreakingKineticTileEntity {
}
@Override
protected void fromTag(CompoundTag compound, boolean clientPacket) {
super.fromTag(compound, clientPacket);
protected void read(CompoundTag compound, boolean clientPacket) {
super.read(compound, clientPacket);
inventory.deserializeNBT(compound.getCompound("Inventory"));
recipeIndex = compound.getInt("RecipeIndex");
if (compound.contains("PlayEvent"))

View file

@ -2,8 +2,8 @@ package com.simibubi.create.content.contraptions.components.structureMovement;
import com.jozufozu.flywheel.light.GPULightVolume;
import com.jozufozu.flywheel.light.GridAlignedBB;
import com.jozufozu.flywheel.light.LightListener;
import com.jozufozu.flywheel.light.ImmutableBox;
import com.jozufozu.flywheel.light.LightListener;
import com.jozufozu.flywheel.light.LightProvider;
import com.jozufozu.flywheel.light.LightUpdater;
import com.jozufozu.flywheel.light.ListenerStatus;

View file

@ -28,7 +28,7 @@ public class DirectionalExtenderScrollOptionSlot extends CenteredSideValueBoxTra
protected void rotate(BlockState state, PoseStack ms) {
if (!getSide().getAxis().isHorizontal())
TransformStack.cast(ms)
.rotateY(AngleHelper.horizontalAngle(state.getValue(BlockStateProperties.FACING)) - 90);
.rotateY(AngleHelper.horizontalAngle(state.getValue(BlockStateProperties.FACING)) + 180);
super.rotate(state, ms);
}
}

View file

@ -1,9 +1,9 @@
package com.simibubi.create.content.contraptions.components.structureMovement;
import com.jozufozu.flywheel.light.GridAlignedBB;
import com.jozufozu.flywheel.light.MovingListener;
import com.jozufozu.flywheel.light.ImmutableBox;
import com.jozufozu.flywheel.light.LightProvider;
import com.jozufozu.flywheel.light.MovingListener;
import com.simibubi.create.foundation.config.AllConfigs;
public class NonStationaryLighter<C extends Contraption> extends ContraptionLighter<C> implements MovingListener {

View file

@ -1,7 +1,7 @@
package com.simibubi.create.content.contraptions.components.structureMovement.bearing;
import com.jozufozu.flywheel.api.instance.IDynamicInstance;
import com.jozufozu.flywheel.api.MaterialManager;
import com.jozufozu.flywheel.api.instance.IDynamicInstance;
import com.jozufozu.flywheel.core.PartialModel;
import com.jozufozu.flywheel.core.materials.oriented.OrientedData;
import com.mojang.math.Quaternion;

View file

@ -310,7 +310,7 @@ public class ClockworkBearingTileEntity extends KineticTileEntity
}
@Override
protected void fromTag(CompoundTag compound, boolean clientPacket) {
protected void read(CompoundTag compound, boolean clientPacket) {
float hourAngleBefore = hourAngle;
float minuteAngleBefore = minuteAngle;
@ -318,7 +318,7 @@ public class ClockworkBearingTileEntity extends KineticTileEntity
hourAngle = compound.getFloat("HourAngle");
minuteAngle = compound.getFloat("MinuteAngle");
lastException = AssemblyException.read(compound);
super.fromTag(compound, clientPacket);
super.read(compound, clientPacket);
if (!clientPacket)
return;

View file

@ -73,9 +73,9 @@ public class MechanicalBearingTileEntity extends GeneratingKineticTileEntity
}
@Override
protected void fromTag(CompoundTag compound, boolean clientPacket) {
protected void read(CompoundTag compound, boolean clientPacket) {
if (wasMoved) {
super.fromTag(compound, clientPacket);
super.read(compound, clientPacket);
return;
}
@ -83,7 +83,7 @@ public class MechanicalBearingTileEntity extends GeneratingKineticTileEntity
running = compound.getBoolean("Running");
angle = compound.getFloat("Angle");
lastException = AssemblyException.read(compound);
super.fromTag(compound, clientPacket);
super.read(compound, clientPacket);
if (!clientPacket)
return;
if (running) {

View file

@ -2,8 +2,8 @@ package com.simibubi.create.content.contraptions.components.structureMovement.be
import javax.annotation.Nullable;
import com.jozufozu.flywheel.backend.Backend;
import com.jozufozu.flywheel.api.MaterialManager;
import com.jozufozu.flywheel.backend.Backend;
import com.jozufozu.flywheel.core.PartialModel;
import com.mojang.math.Quaternion;
import com.simibubi.create.AllBlockPartials;

View file

@ -65,10 +65,10 @@ public class WindmillBearingTileEntity extends MechanicalBearingTileEntity {
}
@Override
protected void fromTag(CompoundTag compound, boolean clientPacket) {
protected void read(CompoundTag compound, boolean clientPacket) {
if (!wasMoved)
lastGeneratedSpeed = compound.getFloat("LastGenerated");
super.fromTag(compound, clientPacket);
super.read(compound, clientPacket);
}
@Override

View file

@ -1,8 +1,8 @@
package com.simibubi.create.content.contraptions.components.structureMovement.chassis;
import com.jozufozu.flywheel.api.MaterialManager;
import com.jozufozu.flywheel.api.instance.IDynamicInstance;
import com.jozufozu.flywheel.backend.instancing.tile.TileEntityInstance;
import com.jozufozu.flywheel.api.MaterialManager;
import com.jozufozu.flywheel.core.materials.model.ModelData;
import com.simibubi.create.AllBlockPartials;
import com.simibubi.create.foundation.utility.AngleHelper;

View file

@ -83,8 +83,8 @@ public class StickerTileEntity extends SmartTileEntity implements FlywheelRender
}
@Override
protected void fromTag(CompoundTag compound, boolean clientPacket) {
super.fromTag(compound, clientPacket);
protected void read(CompoundTag compound, boolean clientPacket) {
super.read(compound, clientPacket);
if (clientPacket)
update = true;
}

View file

@ -1,7 +1,7 @@
package com.simibubi.create.content.contraptions.components.structureMovement.gantry;
import com.jozufozu.flywheel.api.instance.IDynamicInstance;
import com.jozufozu.flywheel.api.MaterialManager;
import com.jozufozu.flywheel.api.instance.IDynamicInstance;
import com.jozufozu.flywheel.core.materials.model.ModelData;
import com.simibubi.create.AllBlockPartials;
import com.simibubi.create.content.contraptions.base.KineticTileEntity;

View file

@ -117,9 +117,9 @@ public class GantryCarriageTileEntity extends KineticTileEntity implements IDisp
}
@Override
protected void fromTag(CompoundTag compound, boolean clientPacket) {
protected void read(CompoundTag compound, boolean clientPacket) {
lastException = AssemblyException.read(compound);
super.fromTag(compound, clientPacket);
super.read(compound, clientPacket);
}
@Override

View file

@ -1,11 +1,11 @@
package com.simibubi.create.content.contraptions.components.structureMovement.glue;
import com.jozufozu.flywheel.backend.gl.attrib.VertexFormat;
import com.jozufozu.flywheel.api.instance.ITickableInstance;
import com.jozufozu.flywheel.api.Instancer;
import com.jozufozu.flywheel.backend.instancing.entity.EntityInstance;
import com.jozufozu.flywheel.api.MaterialGroup;
import com.jozufozu.flywheel.api.MaterialManager;
import com.jozufozu.flywheel.api.instance.ITickableInstance;
import com.jozufozu.flywheel.backend.gl.attrib.VertexFormat;
import com.jozufozu.flywheel.backend.instancing.entity.EntityInstance;
import com.jozufozu.flywheel.core.Formats;
import com.jozufozu.flywheel.core.Materials;
import com.jozufozu.flywheel.core.instancing.ConditionalInstance;

View file

@ -242,9 +242,9 @@ public class CartAssemblerTileEntity extends SmartTileEntity implements IDisplay
}
@Override
protected void fromTag(CompoundTag compound, boolean clientPacket) {
protected void read(CompoundTag compound, boolean clientPacket) {
lastException = AssemblyException.read(compound);
super.fromTag(compound, clientPacket);
super.read(compound, clientPacket);
}
@Override

View file

@ -194,7 +194,7 @@ public abstract class LinearActuatorTileEntity extends KineticTileEntity
}
@Override
protected void fromTag(CompoundTag compound, boolean clientPacket) {
protected void read(CompoundTag compound, boolean clientPacket) {
boolean forceMovement = compound.contains("ForceMovement");
float offsetBefore = offset;
@ -202,7 +202,7 @@ public abstract class LinearActuatorTileEntity extends KineticTileEntity
waitingForSpeedChange = compound.getBoolean("Waiting");
offset = compound.getFloat("Offset");
lastException = AssemblyException.read(compound);
super.fromTag(compound, clientPacket);
super.read(compound, clientPacket);
if (!clientPacket)
return;

View file

@ -32,9 +32,9 @@ public class MechanicalPistonTileEntity extends LinearActuatorTileEntity {
}
@Override
protected void fromTag(CompoundTag compound, boolean clientPacket) {
protected void read(CompoundTag compound, boolean clientPacket) {
extensionLength = compound.getInt("ExtensionLength");
super.fromTag(compound, clientPacket);
super.read(compound, clientPacket);
}
@Override

View file

@ -1,19 +1,19 @@
package com.simibubi.create.content.contraptions.components.structureMovement.pulley;
import com.jozufozu.flywheel.api.instance.IDynamicInstance;
import com.jozufozu.flywheel.api.Instancer;
import com.jozufozu.flywheel.api.MaterialManager;
import com.jozufozu.flywheel.api.instance.IDynamicInstance;
import com.jozufozu.flywheel.core.instancing.ConditionalInstance;
import com.jozufozu.flywheel.core.instancing.GroupInstance;
import com.jozufozu.flywheel.core.instancing.SelectInstance;
import com.jozufozu.flywheel.core.materials.oriented.OrientedData;
import com.jozufozu.flywheel.light.GridAlignedBB;
import com.jozufozu.flywheel.light.MovingListener;
import com.jozufozu.flywheel.light.ImmutableBox;
import com.jozufozu.flywheel.light.LightPacking;
import com.jozufozu.flywheel.light.LightProvider;
import com.jozufozu.flywheel.light.LightUpdater;
import com.jozufozu.flywheel.light.LightVolume;
import com.jozufozu.flywheel.light.MovingListener;
import com.mojang.math.Vector3f;
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
import com.simibubi.create.content.contraptions.relays.encased.ShaftInstance;

View file

@ -193,10 +193,10 @@ public class PulleyTileEntity extends LinearActuatorTileEntity {
}
@Override
protected void fromTag(CompoundTag compound, boolean clientPacket) {
protected void read(CompoundTag compound, boolean clientPacket) {
initialOffset = compound.getInt("InitialOffset");
needsContraption = compound.getBoolean("NeedsContraption");
super.fromTag(compound, clientPacket);
super.read(compound, clientPacket);
}
@Override

View file

@ -7,8 +7,8 @@ import javax.annotation.Nullable;
import org.apache.commons.lang3.tuple.Pair;
import com.jozufozu.flywheel.backend.instancing.tile.TileInstanceManager;
import com.jozufozu.flywheel.api.MaterialManager;
import com.jozufozu.flywheel.backend.instancing.tile.TileInstanceManager;
import com.simibubi.create.AllMovementBehaviours;
import com.simibubi.create.content.contraptions.components.structureMovement.MovementBehaviour;
import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext;

View file

@ -4,9 +4,9 @@ import static org.lwjgl.opengl.GL11.glBindTexture;
import static org.lwjgl.opengl.GL12.GL_TEXTURE_3D;
import com.jozufozu.flywheel.backend.Backend;
import com.jozufozu.flywheel.backend.RenderLayer;
import com.jozufozu.flywheel.backend.gl.GlTextureUnit;
import com.jozufozu.flywheel.backend.gl.GlVertexArray;
import com.jozufozu.flywheel.backend.RenderLayer;
import com.jozufozu.flywheel.event.RenderLayerEvent;
import com.jozufozu.flywheel.util.TextureBinder;
import com.simibubi.create.content.contraptions.components.structureMovement.Contraption;

View file

@ -28,8 +28,8 @@ public class WaterWheelTileEntity extends GeneratingKineticTileEntity {
}
@Override
protected void fromTag(CompoundTag compound, boolean clientPacket) {
super.fromTag(compound, clientPacket);
protected void read(CompoundTag compound, boolean clientPacket) {
super.read(compound, clientPacket);
if (compound.contains("Flows")) {
for (Direction d : Iterate.directions)
setFlow(d, compound.getCompound("Flows")

View file

@ -311,9 +311,9 @@ public class PumpTileEntity extends KineticTileEntity {
}
@Override
protected void fromTag(CompoundTag compound, boolean clientPacket) {
protected void read(CompoundTag compound, boolean clientPacket) {
reversed = compound.getBoolean("Reversed");
super.fromTag(compound, clientPacket);
super.read(compound, clientPacket);
}
public void updatePipesOnSide(Direction side) {

View file

@ -155,10 +155,10 @@ public class HosePulleyTileEntity extends KineticTileEntity {
}
@Override
protected void fromTag(CompoundTag compound, boolean clientPacket) {
protected void read(CompoundTag compound, boolean clientPacket) {
offset.readNBT(compound.getCompound("Offset"), clientPacket);
internalTank.readFromNBT(compound.getCompound("Tank"));
super.fromTag(compound, clientPacket);
super.read(compound, clientPacket);
if (clientPacket)
infinite = compound.getBoolean("Infinite");
}

View file

@ -270,12 +270,12 @@ public class ItemDrainTileEntity extends SmartTileEntity implements IHaveGoggleI
}
@Override
protected void fromTag(CompoundTag compound, boolean clientPacket) {
protected void read(CompoundTag compound, boolean clientPacket) {
heldItem = null;
processingTicks = compound.getInt("ProcessingTicks");
if (compound.contains("HeldItem"))
heldItem = TransportedItemStack.read(compound.getCompound("HeldItem"));
super.fromTag(compound, clientPacket);
super.read(compound, clientPacket);
}
@Override

View file

@ -151,8 +151,8 @@ public class SpoutTileEntity extends SmartTileEntity implements IHaveGoggleInfor
}
@Override
protected void fromTag(CompoundTag compound, boolean clientPacket) {
super.fromTag(compound, clientPacket);
protected void read(CompoundTag compound, boolean clientPacket) {
super.read(compound, clientPacket);
processingTicks = compound.getInt("ProcessingTicks");
if (!clientPacket)
return;

View file

@ -1,7 +1,7 @@
package com.simibubi.create.content.contraptions.fluids.pipes;
import com.jozufozu.flywheel.api.instance.IDynamicInstance;
import com.jozufozu.flywheel.api.MaterialManager;
import com.jozufozu.flywheel.api.instance.IDynamicInstance;
import com.jozufozu.flywheel.core.Materials;
import com.jozufozu.flywheel.core.materials.model.ModelData;
import com.simibubi.create.AllBlockPartials;

View file

@ -70,8 +70,8 @@ public class FluidValveTileEntity extends KineticTileEntity {
}
@Override
protected void fromTag(CompoundTag compound, boolean clientPacket) {
super.fromTag(compound, clientPacket);
protected void read(CompoundTag compound, boolean clientPacket) {
super.read(compound, clientPacket);
pointer.readNBT(compound.getCompound("Pointer"), clientPacket);
}

View file

@ -338,8 +338,8 @@ public class FluidTankTileEntity extends SmartTileEntity implements IHaveGoggleI
}
@Override
protected void fromTag(CompoundTag compound, boolean clientPacket) {
super.fromTag(compound, clientPacket);
protected void read(CompoundTag compound, boolean clientPacket) {
super.read(compound, clientPacket);
BlockPos controllerBefore = controller;
int prevSize = width;

View file

@ -26,7 +26,6 @@ import com.simibubi.create.foundation.utility.outliner.Outline;
import com.simibubi.create.foundation.utility.outliner.Outliner.OutlineEntry;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
@ -151,10 +150,7 @@ public class GoggleOverlayRenderer {
return;
poseStack.pushPose();
Screen tooltipScreen = new TooltipScreen(new TextComponent(""));
tooltipScreen.init(mc, width, height);
int titleLinesCount = 1;
int tooltipTextWidth = 0;
for (FormattedText textLine : tooltip) {
int textLineWidth = mc.font.width(textLine);
@ -164,17 +160,16 @@ public class GoggleOverlayRenderer {
int tooltipHeight = 8;
if (tooltip.size() > 1) {
tooltipHeight += (tooltip.size() - 1) * 10;
if (tooltip.size() > titleLinesCount)
tooltipHeight += 2; // gap between title lines and next lines
tooltipHeight += (tooltip.size() - 1) * 10;
}
CClient cfg = AllConfigs.CLIENT;
int posX = tooltipScreen.width / 2 + cfg.overlayOffsetX.get();
int posY = tooltipScreen.height / 2 + cfg.overlayOffsetY.get();
int posX = width / 2 + cfg.overlayOffsetX.get();
int posY = height / 2 + cfg.overlayOffsetY.get();
posX = Math.min(posX, tooltipScreen.width - tooltipTextWidth - 20);
posY = Math.min(posY, tooltipScreen.height - tooltipHeight - 20);
posX = Math.min(posX, width - tooltipTextWidth - 20);
posY = Math.min(posY, height - tooltipHeight - 20);
float fade = Mth.clamp((hoverTicks + partialTicks) / 12f, 0, 1);
Boolean useCustom = cfg.overlayCustomColor.get();
@ -195,7 +190,7 @@ public class GoggleOverlayRenderer {
colorBorderBot.scaleAlpha(fade);
}
RemovedGuiUtils.drawHoveringText(poseStack, tooltip, posX, posY, tooltipScreen.width, tooltipScreen.height, -1,
RemovedGuiUtils.drawHoveringText(poseStack, tooltip, posX, posY, width, height, -1,
colorBackground.getRGB(), colorBorderTop.getRGB(), colorBorderBot.getRGB(), mc.font);
ItemStack item = AllItems.GOGGLES.asStack();
@ -206,26 +201,11 @@ public class GoggleOverlayRenderer {
}
/**
* Use this method to add custom entry points to the goggle overay, e.g. custom
* Use this method to add custom entry points to the goggles overlay, e.g. custom
* armor, handheld alternatives, etc.
*/
public static void registerCustomGoggleCondition(Supplier<Boolean> condition) {
customGogglePredicates.add(condition);
}
public static final class TooltipScreen extends Screen {
public TooltipScreen(Component p_i51108_1_) {
super(p_i51108_1_);
}
// @Override
// public void init(Minecraft mc, int width, int height) {
// this.minecraft = mc;
// this.itemRenderer = mc.getItemRenderer();
// this.font = mc.font;
// this.width = width;
// this.height = height;
// }
}
}

View file

@ -140,8 +140,8 @@ public class BasinTileEntity extends SmartTileEntity implements IHaveGoggleInfor
}
@Override
protected void fromTag(CompoundTag compound, boolean clientPacket) {
super.fromTag(compound, clientPacket);
protected void read(CompoundTag compound, boolean clientPacket) {
super.read(compound, clientPacket);
inputInventory.deserializeNBT(compound.getCompound("InputItems"));
outputInventory.deserializeNBT(compound.getCompound("OutputItems"));

View file

@ -67,7 +67,7 @@ public class ProcessingOutput {
if (count != 1)
json.addProperty("count", count);
if (stack.hasTag())
json.add("nbt", new JsonParser().parse(stack.getTag()
json.add("nbt", JsonParser.parseString(stack.getTag()
.toString()));
if (chance != 1)
json.addProperty("chance", chance);

View file

@ -135,11 +135,11 @@ public class BlazeBurnerTileEntity extends SmartTileEntity {
}
@Override
protected void fromTag(CompoundTag compound, boolean clientPacket) {
protected void read(CompoundTag compound, boolean clientPacket) {
activeFuel = FuelType.values()[compound.getInt("fuelLevel")];
remainingBurnTime = compound.getInt("burnTimeRemaining");
isCreative = compound.getBoolean("isCreative");
super.fromTag(compound, clientPacket);
super.read(compound, clientPacket);
}
public BlazeBurnerBlock.HeatLevel getHeatLevelFromBlock() {

View file

@ -146,14 +146,14 @@ public class SequencedGearshiftTileEntity extends SplitShaftTileEntity {
}
@Override
protected void fromTag(CompoundTag compound, boolean clientPacket) {
protected void read(CompoundTag compound, boolean clientPacket) {
currentInstruction = compound.getInt("InstructionIndex");
currentInstructionDuration = compound.getInt("InstructionDuration");
currentInstructionProgress = compound.getFloat("InstructionProgress");
poweredPreviously = compound.getBoolean("PrevPowered");
timer = compound.getInt("Timer");
instructions = Instruction.deserializeAll(compound.getList("Instructions", Tag.TAG_COMPOUND));
super.fromTag(compound, clientPacket);
super.read(compound, clientPacket);
}
@Override

View file

@ -14,8 +14,8 @@ import java.util.function.Function;
import com.jozufozu.flywheel.backend.instancing.InstancedRenderDispatcher;
import com.jozufozu.flywheel.light.GridAlignedBB;
import com.jozufozu.flywheel.light.LightListener;
import com.jozufozu.flywheel.light.ImmutableBox;
import com.jozufozu.flywheel.light.LightListener;
import com.jozufozu.flywheel.light.LightProvider;
import com.jozufozu.flywheel.light.LightUpdater;
import com.jozufozu.flywheel.light.ListenerStatus;
@ -214,9 +214,9 @@ public class BeltTileEntity extends KineticTileEntity implements LightListener {
}
@Override
protected void fromTag(CompoundTag compound, boolean clientPacket) {
protected void read(CompoundTag compound, boolean clientPacket) {
int prevBeltLength = beltLength;
super.fromTag(compound, clientPacket);
super.read(compound, clientPacket);
if (compound.getBoolean("IsController"))
controller = worldPosition;

View file

@ -25,9 +25,9 @@ public class AdjustablePulleyTileEntity extends KineticTileEntity {
}
@Override
protected void fromTag(CompoundTag compound, boolean clientPacket) {
protected void read(CompoundTag compound, boolean clientPacket) {
signal = compound.getInt("Signal");
super.fromTag(compound, clientPacket);
super.read(compound, clientPacket);
}
public float getModifier() {

View file

@ -2,9 +2,9 @@ package com.simibubi.create.content.contraptions.relays.gauge;
import java.util.ArrayList;
import com.jozufozu.flywheel.api.instance.IDynamicInstance;
import com.jozufozu.flywheel.api.Instancer;
import com.jozufozu.flywheel.api.MaterialManager;
import com.jozufozu.flywheel.api.instance.IDynamicInstance;
import com.jozufozu.flywheel.core.materials.model.ModelData;
import com.jozufozu.flywheel.util.transform.TransformStack;
import com.mojang.blaze3d.vertex.PoseStack;

View file

@ -31,10 +31,10 @@ public class GaugeTileEntity extends KineticTileEntity implements IHaveGoggleInf
}
@Override
protected void fromTag(CompoundTag compound, boolean clientPacket) {
protected void read(CompoundTag compound, boolean clientPacket) {
dialTarget = compound.getFloat("Value");
color = compound.getInt("Color");
super.fromTag(compound, clientPacket);
super.read(compound, clientPacket);
}
@Override

View file

@ -2,10 +2,10 @@ package com.simibubi.create.content.curiosities.armor;
import java.util.function.Supplier;
import com.google.common.base.Suppliers;
import com.simibubi.create.AllSoundEvents;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.util.LazyLoadedValue;
import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.item.ArmorMaterial;
import net.minecraft.world.item.Items;
@ -28,7 +28,7 @@ public enum AllArmorMaterials implements ArmorMaterial {
private final SoundEvent soundEvent;
private final float toughness;
private final float knockbackResistance;
private final LazyLoadedValue<Ingredient> repairMaterial;
private final Supplier<Ingredient> repairMaterial;
private AllArmorMaterials(String p_i231593_3_, int p_i231593_4_, int[] p_i231593_5_, int p_i231593_6_,
SoundEvent p_i231593_7_, float p_i231593_8_, float p_i231593_9_, Supplier<Ingredient> p_i231593_10_) {
@ -39,7 +39,7 @@ public enum AllArmorMaterials implements ArmorMaterial {
this.soundEvent = p_i231593_7_;
this.toughness = p_i231593_8_;
this.knockbackResistance = p_i231593_9_;
this.repairMaterial = new LazyLoadedValue<>(p_i231593_10_);
this.repairMaterial = Suppliers.memoize(p_i231593_10_::get);
}
public int getDurabilityForSlot(EquipmentSlot p_200896_1_) {

View file

@ -95,8 +95,8 @@ public class CopperBacktankTileEntity extends KineticTileEntity implements Namea
}
@Override
protected void fromTag(CompoundTag compound, boolean clientPacket) {
super.fromTag(compound, clientPacket);
protected void read(CompoundTag compound, boolean clientPacket) {
super.read(compound, clientPacket);
int prev = airLevel;
capacityEnchantLevel = compound.getInt("CapacityEnchantment");
airLevel = compound.getInt("Air");

View file

@ -1,11 +1,9 @@
package com.simibubi.create.content.curiosities.bell;
import java.util.List;
import java.util.Random;
import com.jozufozu.flywheel.core.PartialModel;
import com.simibubi.create.AllBlockPartials;
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
@ -29,9 +27,6 @@ public class HauntedBellTileEntity extends AbstractBellTileEntity {
super(type, pos, state);
}
@Override
public void addBehaviours(List<TileEntityBehaviour> behaviours) { }
@Override
public PartialModel getBellModel() {
return AllBlockPartials.HAUNTED_BELL;
@ -65,8 +60,8 @@ public class HauntedBellTileEntity extends AbstractBellTileEntity {
}
@Override
protected void fromTag(CompoundTag compound, boolean clientPacket) {
super.fromTag(compound, clientPacket);
protected void read(CompoundTag compound, boolean clientPacket) {
super.read(compound, clientPacket);
effectTicks = compound.getInt("EffectTicks");
}

View file

@ -1,9 +1,9 @@
package com.simibubi.create.content.curiosities.toolbox;
import com.jozufozu.flywheel.api.instance.IDynamicInstance;
import com.jozufozu.flywheel.api.Instancer;
import com.jozufozu.flywheel.backend.instancing.tile.TileEntityInstance;
import com.jozufozu.flywheel.api.MaterialManager;
import com.jozufozu.flywheel.api.instance.IDynamicInstance;
import com.jozufozu.flywheel.backend.instancing.tile.TileEntityInstance;
import com.jozufozu.flywheel.core.Materials;
import com.jozufozu.flywheel.core.materials.model.ModelData;
import com.simibubi.create.AllBlockPartials;

View file

@ -43,7 +43,7 @@ public class ToolboxContainer extends ContainerBase<ToolboxTileEntity> {
BlockEntity tileEntity = world.getBlockEntity(readBlockPos);
if (tileEntity instanceof ToolboxTileEntity) {
ToolboxTileEntity toolbox = (ToolboxTileEntity) tileEntity;
toolbox.handleUpdateTag(readNbt);
toolbox.readClient(readNbt);
return toolbox;
}

View file

@ -14,8 +14,8 @@ import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraftforge.network.NetworkEvent.Context;
import net.minecraftforge.items.ItemHandlerHelper;
import net.minecraftforge.network.NetworkEvent.Context;
public class ToolboxDisposeAllPacket extends SimplePacketBase {

View file

@ -12,8 +12,8 @@ import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraftforge.network.NetworkEvent.Context;
import net.minecraftforge.items.ItemHandlerHelper;
import net.minecraftforge.network.NetworkEvent.Context;
public class ToolboxEquipPacket extends SimplePacketBase {

View file

@ -283,9 +283,9 @@ public class ToolboxTileEntity extends SmartTileEntity implements MenuProvider,
}
@Override
protected void fromTag(CompoundTag compound, boolean clientPacket) {
protected void read(CompoundTag compound, boolean clientPacket) {
inventory.deserializeNBT(compound.getCompound("Inventory"));
super.fromTag(compound, clientPacket);
super.read(compound, clientPacket);
if (compound.contains("UniqueId", 11))
this.uniqueId = compound.getUUID("UniqueId");
if (compound.contains("CustomName", 8))

View file

@ -2,7 +2,9 @@ package com.simibubi.create.content.curiosities.tools;
import java.util.UUID;
import java.util.function.Consumer;
import java.util.function.Supplier;
import com.google.common.base.Suppliers;
import com.google.common.collect.ImmutableMultimap;
import com.google.common.collect.Multimap;
import com.simibubi.create.AllItems;
@ -17,7 +19,6 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.util.LazyLoadedValue;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity;
@ -65,13 +66,15 @@ public class ExtendoGripItem extends Item {
new AttributeModifier(UUID.fromString("8f7dbdb2-0d0d-458a-aa40-ac7633691f66"), "Range modifier", 5,
AttributeModifier.Operation.ADDITION);
static LazyLoadedValue<Multimap<Attribute, AttributeModifier>> rangeModifier = new LazyLoadedValue<>(() ->
static Supplier<Multimap<Attribute, AttributeModifier>> rangeModifier = Suppliers.memoize(() ->
// Holding an ExtendoGrip
ImmutableMultimap.of(ForgeMod.REACH_DISTANCE.get(), singleRangeAttributeModifier));
ImmutableMultimap.of(ForgeMod.REACH_DISTANCE.get(), singleRangeAttributeModifier)
);
static LazyLoadedValue<Multimap<Attribute, AttributeModifier>> doubleRangeModifier = new LazyLoadedValue<>(() ->
static Supplier<Multimap<Attribute, AttributeModifier>> doubleRangeModifier = Suppliers.memoize(() ->
// Holding two ExtendoGrips o.O
ImmutableMultimap.of(ForgeMod.REACH_DISTANCE.get(), doubleRangeAttributeModifier));
ImmutableMultimap.of(ForgeMod.REACH_DISTANCE.get(), doubleRangeAttributeModifier)
);
public ExtendoGripItem(Properties properties) {
super(properties.stacksTo(1)

View file

@ -36,7 +36,7 @@ public class ZapperLog {
List<StructureBlockInfo> blocks = positions.stream().map(pos -> {
BlockEntity tileEntity = world.getBlockEntity(pos);
return new StructureBlockInfo(pos, world.getBlockState(pos), tileEntity == null ? null : tileEntity.serializeNBT());
return new StructureBlockInfo(pos, world.getBlockState(pos), tileEntity == null ? null : tileEntity.saveWithFullMetadata());
}).collect(Collectors.toList());
log.add(0, blocks);

View file

@ -5,11 +5,11 @@ import java.util.Collection;
import java.util.EnumMap;
import java.util.Map;
import com.jozufozu.flywheel.api.instance.IDynamicInstance;
import com.jozufozu.flywheel.api.InstanceData;
import com.jozufozu.flywheel.api.Instancer;
import com.jozufozu.flywheel.backend.instancing.tile.TileEntityInstance;
import com.jozufozu.flywheel.api.MaterialManager;
import com.jozufozu.flywheel.api.instance.IDynamicInstance;
import com.jozufozu.flywheel.backend.instancing.tile.TileEntityInstance;
import com.simibubi.create.AllBlockPartials;
import com.simibubi.create.content.logistics.block.flap.FlapData;
import com.simibubi.create.foundation.render.AllMaterialSpecs;

View file

@ -77,7 +77,7 @@ public class BeltTunnelTileEntity extends SmartTileEntity implements FlywheelRen
}
@Override
protected void fromTag(CompoundTag compound, boolean clientPacket) {
protected void read(CompoundTag compound, boolean clientPacket) {
Set<Direction> newFlaps = new HashSet<>(6);
ListTag flapsNBT = compound.getList("Flaps", Tag.TAG_INT);
for (Tag inbt : flapsNBT)
@ -101,7 +101,7 @@ public class BeltTunnelTileEntity extends SmartTileEntity implements FlywheelRen
// Backwards compat
if (!compound.contains("Sides") && compound.contains("Flaps"))
sides.addAll(flaps.keySet());
super.fromTag(compound, clientPacket);
super.read(compound, clientPacket);
if (clientPacket)
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> InstancedRenderDispatcher.enqueueUpdate(this));
}

View file

@ -581,7 +581,7 @@ public class BrassTunnelTileEntity extends BeltTunnelTileEntity implements IHave
}
@Override
protected void fromTag(CompoundTag compound, boolean clientPacket) {
protected void read(CompoundTag compound, boolean clientPacket) {
boolean wasConnectedLeft = connectedLeft;
boolean wasConnectedRight = connectedRight;
@ -603,7 +603,7 @@ public class BrassTunnelTileEntity extends BeltTunnelTileEntity implements IHave
}));
}
super.fromTag(compound, clientPacket);
super.read(compound, clientPacket);
if (!clientPacket)
return;

View file

@ -520,14 +520,14 @@ public class ChuteTileEntity extends SmartTileEntity implements IHaveGoggleInfor
}
@Override
protected void fromTag(CompoundTag compound, boolean clientPacket) {
protected void read(CompoundTag compound, boolean clientPacket) {
ItemStack previousItem = item;
item = ItemStack.of(compound.getCompound("Item"));
itemPosition.lastValue = itemPosition.value = compound.getFloat("ItemPosition");
pull = compound.getFloat("Pull");
push = compound.getFloat("Push");
bottomPullDistance = compound.getFloat("BottomAirFlowDistance");
super.fromTag(compound, clientPacket);
super.read(compound, clientPacket);
// if (clientPacket)
// airCurrent.rebuild();

View file

@ -1,7 +1,7 @@
package com.simibubi.create.content.logistics.block.depot;
import com.jozufozu.flywheel.api.instance.IDynamicInstance;
import com.jozufozu.flywheel.api.MaterialManager;
import com.jozufozu.flywheel.api.instance.IDynamicInstance;
import com.jozufozu.flywheel.core.materials.model.ModelData;
import com.simibubi.create.AllBlockPartials;
import com.simibubi.create.content.contraptions.relays.encased.ShaftInstance;

View file

@ -518,8 +518,8 @@ public class EjectorTileEntity extends KineticTileEntity {
}
@Override
protected void fromTag(CompoundTag compound, boolean clientPacket) {
super.fromTag(compound, clientPacket);
protected void read(CompoundTag compound, boolean clientPacket) {
super.read(compound, clientPacket);
int horizontalDistance = compound.getInt("HorizontalDistance");
int verticalDistance = compound.getInt("VerticalDistance");

View file

@ -1,8 +1,8 @@
package com.simibubi.create.content.logistics.block.diodes;
import com.jozufozu.flywheel.api.MaterialManager;
import com.jozufozu.flywheel.api.instance.ITickableInstance;
import com.jozufozu.flywheel.backend.instancing.tile.TileEntityInstance;
import com.jozufozu.flywheel.api.MaterialManager;
import com.jozufozu.flywheel.core.Materials;
import com.jozufozu.flywheel.core.materials.model.ModelData;
import com.simibubi.create.AllBlockPartials;

View file

@ -66,9 +66,9 @@ public abstract class BrassDiodeTileEntity extends SmartTileEntity implements Fl
}
@Override
protected void fromTag(CompoundTag compound, boolean clientPacket) {
protected void read(CompoundTag compound, boolean clientPacket) {
state = compound.getInt("State");
super.fromTag(compound, clientPacket);
super.read(compound, clientPacket);
}
@Override

View file

@ -1,11 +1,11 @@
package com.simibubi.create.content.logistics.block.flap;
import com.jozufozu.flywheel.backend.gl.attrib.VertexFormat;
import com.jozufozu.flywheel.backend.gl.buffer.VecBuffer;
import com.jozufozu.flywheel.api.struct.Batched;
import com.jozufozu.flywheel.api.struct.BatchingTransformer;
import com.jozufozu.flywheel.api.struct.StructWriter;
import com.jozufozu.flywheel.api.struct.Instanced;
import com.jozufozu.flywheel.api.struct.StructWriter;
import com.jozufozu.flywheel.backend.gl.attrib.VertexFormat;
import com.jozufozu.flywheel.backend.gl.buffer.VecBuffer;
import com.jozufozu.flywheel.core.model.Model;
import com.simibubi.create.foundation.render.AllInstanceFormats;
import com.simibubi.create.foundation.render.AllProgramSpecs;

View file

@ -2,8 +2,8 @@ package com.simibubi.create.content.logistics.block.flap;
import org.lwjgl.system.MemoryUtil;
import com.jozufozu.flywheel.backend.gl.buffer.VecBuffer;
import com.jozufozu.flywheel.api.struct.StructType;
import com.jozufozu.flywheel.backend.gl.buffer.VecBuffer;
import com.jozufozu.flywheel.backend.struct.UnsafeBufferWriter;
public class UnsafeFlapWriter extends UnsafeBufferWriter<FlapData> {

View file

@ -2,11 +2,11 @@ package com.simibubi.create.content.logistics.block.funnel;
import java.util.ArrayList;
import com.jozufozu.flywheel.api.instance.IDynamicInstance;
import com.jozufozu.flywheel.api.InstanceData;
import com.jozufozu.flywheel.api.Instancer;
import com.jozufozu.flywheel.backend.instancing.tile.TileEntityInstance;
import com.jozufozu.flywheel.api.MaterialManager;
import com.jozufozu.flywheel.api.instance.IDynamicInstance;
import com.jozufozu.flywheel.backend.instancing.tile.TileEntityInstance;
import com.jozufozu.flywheel.core.PartialModel;
import com.simibubi.create.AllBlockPartials;
import com.simibubi.create.content.logistics.block.flap.FlapData;

View file

@ -323,8 +323,8 @@ public class FunnelTileEntity extends SmartTileEntity implements IHaveHoveringIn
}
@Override
protected void fromTag(CompoundTag compound, boolean clientPacket) {
super.fromTag(compound, clientPacket);
protected void read(CompoundTag compound, boolean clientPacket) {
super.read(compound, clientPacket);
extractionCooldown = compound.getInt("TransferCooldown");
if (clientPacket)

View file

@ -3,11 +3,11 @@ package com.simibubi.create.content.logistics.block.mechanicalArm;
import java.util.ArrayList;
import com.google.common.collect.Lists;
import com.jozufozu.flywheel.api.instance.IDynamicInstance;
import com.jozufozu.flywheel.api.InstanceData;
import com.jozufozu.flywheel.api.Instancer;
import com.jozufozu.flywheel.api.Material;
import com.jozufozu.flywheel.api.MaterialManager;
import com.jozufozu.flywheel.api.instance.IDynamicInstance;
import com.jozufozu.flywheel.core.materials.model.ModelData;
import com.jozufozu.flywheel.util.transform.TransformStack;
import com.mojang.blaze3d.vertex.PoseStack;

View file

@ -467,12 +467,12 @@ public class ArmTileEntity extends KineticTileEntity implements ITransformableTE
}
@Override
protected void fromTag(CompoundTag compound, boolean clientPacket) {
protected void read(CompoundTag compound, boolean clientPacket) {
int previousIndex = chasedPointIndex;
Phase previousPhase = phase;
ListTag interactionPointTagBefore = interactionPointTag;
super.fromTag(compound, clientPacket);
super.read(compound, clientPacket);
heldItem = ItemStack.of(compound.getCompound("HeldItem"));
phase = NBTHelper.readEnum(compound, "Phase", Phase.class);
chasedPointIndex = compound.getInt("TargetPointIndex");

View file

@ -1,9 +1,9 @@
package com.simibubi.create.content.logistics.block.redstone;
import com.jozufozu.flywheel.api.instance.IDynamicInstance;
import com.jozufozu.flywheel.backend.instancing.tile.TileEntityInstance;
import com.jozufozu.flywheel.api.Material;
import com.jozufozu.flywheel.api.MaterialManager;
import com.jozufozu.flywheel.api.instance.IDynamicInstance;
import com.jozufozu.flywheel.backend.instancing.tile.TileEntityInstance;
import com.jozufozu.flywheel.core.materials.model.ModelData;
import com.jozufozu.flywheel.util.transform.Rotate;
import com.jozufozu.flywheel.util.transform.Translate;

View file

@ -34,11 +34,11 @@ public class AnalogLeverTileEntity extends SmartTileEntity implements IHaveGoggl
}
@Override
protected void fromTag(CompoundTag compound, boolean clientPacket) {
protected void read(CompoundTag compound, boolean clientPacket) {
state = compound.getInt("State");
lastChange = compound.getInt("ChangeTimer");
clientState.target(state);
super.fromTag(compound, clientPacket);
super.read(compound, clientPacket);
}
@Override

View file

@ -128,8 +128,8 @@ public class ContentObserverTileEntity extends SmartTileEntity {
}
@Override
protected void fromTag(CompoundTag compound, boolean clientPacket) {
super.fromTag(compound, clientPacket);
protected void read(CompoundTag compound, boolean clientPacket) {
super.read(compound, clientPacket);
turnOffTicks = compound.getInt("TurnOff");
}

View file

@ -114,8 +114,8 @@ public class NixieTubeTileEntity extends SmartTileEntity {
//
@Override
protected void fromTag(CompoundTag nbt, boolean clientPacket) {
super.fromTag(nbt, clientPacket);
protected void read(CompoundTag nbt, boolean clientPacket) {
super.read(nbt, clientPacket);
if (nbt.contains("RawCustomText", Tag.TAG_STRING)) {
rawCustomText = getJsonFromString(nbt.getString("RawCustomText"));
@ -164,7 +164,7 @@ public class NixieTubeTileEntity extends SmartTileEntity {
private JsonElement getJsonFromString(String string) {
try {
return new JsonParser().parse(string);
return JsonParser.parseString(string);
} catch (JsonParseException e) {
return null;
}

Some files were not shown because too many files have changed in this diff Show more