mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-15 09:33:40 +01:00
Chipping away, Part II
This commit is contained in:
parent
0cb7a0260e
commit
00b6a32e77
270 changed files with 1697 additions and 1867 deletions
|
@ -205,7 +205,6 @@ import net.minecraft.world.level.storage.loot.providers.number.ConstantValue;
|
|||
import net.minecraftforge.client.model.generators.ConfiguredModel;
|
||||
import net.minecraftforge.client.model.generators.ModelFile;
|
||||
import net.minecraftforge.common.Tags;
|
||||
import net.minecraftforge.common.ToolType;
|
||||
|
||||
public class AllBlocks {
|
||||
|
||||
|
@ -1018,13 +1017,14 @@ public class AllBlocks {
|
|||
.simpleItem()
|
||||
.register();
|
||||
|
||||
public static final BlockEntry<SailBlock> SAIL = REGISTRATE.block("white_sail", p -> SailBlock.withCanvas(p, DyeColor.WHITE))
|
||||
.initialProperties(SharedProperties::wooden)
|
||||
.properties(BlockBehaviour.Properties::noOcclusion)
|
||||
.blockstate(BlockStateGen.directionalBlockProvider(false))
|
||||
.tag(AllBlockTags.WINDMILL_SAILS.tag)
|
||||
.simpleItem()
|
||||
.register();
|
||||
public static final BlockEntry<SailBlock> SAIL =
|
||||
REGISTRATE.block("white_sail", p -> SailBlock.withCanvas(p, DyeColor.WHITE))
|
||||
.initialProperties(SharedProperties::wooden)
|
||||
.properties(BlockBehaviour.Properties::noOcclusion)
|
||||
.blockstate(BlockStateGen.directionalBlockProvider(false))
|
||||
.tag(AllBlockTags.WINDMILL_SAILS.tag)
|
||||
.simpleItem()
|
||||
.register();
|
||||
|
||||
public static final DyedBlockList<SailBlock> DYED_SAILS = new DyedBlockList<>(colour -> {
|
||||
if (colour == DyeColor.WHITE) {
|
||||
|
@ -1401,8 +1401,7 @@ public class AllBlocks {
|
|||
|
||||
public static final BlockEntry<Block> ZINC_ORE = REGISTRATE.block("zinc_ore", Block::new)
|
||||
.initialProperties(() -> Blocks.GOLD_BLOCK)
|
||||
.properties(p -> p.harvestLevel(2)
|
||||
.harvestTool(ToolType.PICKAXE)
|
||||
.properties(p -> p.requiresCorrectToolForDrops()
|
||||
.sound(SoundType.STONE))
|
||||
.tag(Tags.Blocks.ORES)
|
||||
.transform(tagBlockAndItem("ores/zinc"))
|
||||
|
|
|
@ -13,21 +13,23 @@ import net.minecraftforge.eventbus.api.GenericEvent;
|
|||
/**
|
||||
* Event that is fired just before a SmartTileEntity is being deserealized <br>
|
||||
* Also if a new one is placed<br>
|
||||
* Use it to attach a new {@link TileEntityBehaviour} or replace existing ones (with caution) <br>
|
||||
* Use it to attach a new {@link TileEntityBehaviour} or replace existing ones
|
||||
* (with caution) <br>
|
||||
* <br>
|
||||
* Actual setup of the behaviours internal workings and data should be done in TileEntityBehaviour#read() and TileEntityBehaviour#initialize() respectively.<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 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
|
||||
*/
|
||||
public class TileEntityBehaviourEvent<T extends SmartTileEntity> extends GenericEvent<T> {
|
||||
|
||||
private BlockState state;
|
||||
private T smartTileEntity;
|
||||
private Map<BehaviourType<?>, TileEntityBehaviour> behaviours;
|
||||
|
||||
public TileEntityBehaviourEvent(BlockState state, T tileEntity,
|
||||
Map<BehaviourType<?>, TileEntityBehaviour> behaviours) {
|
||||
this.state = state;
|
||||
public TileEntityBehaviourEvent(T tileEntity, Map<BehaviourType<?>, TileEntityBehaviour> behaviours) {
|
||||
smartTileEntity = tileEntity;
|
||||
this.behaviours = behaviours;
|
||||
}
|
||||
|
@ -50,7 +52,7 @@ public class TileEntityBehaviourEvent<T extends SmartTileEntity> extends Generic
|
|||
}
|
||||
|
||||
public BlockState getBlockState() {
|
||||
return state;
|
||||
return smartTileEntity.getBlockState();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,27 +4,32 @@ import java.util.function.BiConsumer;
|
|||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.ferreusveritas.dynamictrees.api.TreeHelper;
|
||||
import com.ferreusveritas.dynamictrees.blocks.branches.BranchBlock;
|
||||
import com.ferreusveritas.dynamictrees.blocks.branches.TrunkShellBlock;
|
||||
import com.ferreusveritas.dynamictrees.util.BranchDestructionData;
|
||||
import com.simibubi.create.foundation.utility.AbstractBlockBreakQueue;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
|
||||
// Commented until dynamic trees are updated
|
||||
public class DynamicTree extends AbstractBlockBreakQueue {
|
||||
private BlockPos startCutPos;
|
||||
|
||||
// private BlockPos startCutPos;
|
||||
|
||||
public DynamicTree(BlockPos startCutPos) {
|
||||
this.startCutPos = startCutPos;
|
||||
// this.startCutPos = startCutPos;
|
||||
}
|
||||
|
||||
public static boolean isDynamicBranch(Block block) {
|
||||
return false; // TreeHelper.isBranch(block) || block instanceof TrunkShellBlock;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void destroyBlocks(Level world, ItemStack toDamage, @Nullable Player playerEntity, BiConsumer<BlockPos, ItemStack> drop) {
|
||||
/*
|
||||
|
||||
BranchBlock start = TreeHelper.getBranch(world.getBlockState(startCutPos));
|
||||
if (start == null) //if start is null, it was not a branch
|
||||
start = setBranchToShellMuse(world, world.getBlockState(startCutPos)); //we check for a trunk shell instead
|
||||
|
@ -41,9 +46,13 @@ public class DynamicTree extends AbstractBlockBreakQueue {
|
|||
// Feed all the tree drops to drop bi-consumer
|
||||
data.leavesDrops.forEach(stackPos -> drop.accept(stackPos.pos.offset(startCutPos), stackPos.stack));
|
||||
start.getLogDrops(world, startCutPos, data.species, data.woodVolume).forEach(stack -> drop.accept(startCutPos, stack));
|
||||
|
||||
*/
|
||||
}
|
||||
|
||||
private BranchBlock setBranchToShellMuse(World world, BlockState state){
|
||||
/*
|
||||
private BranchBlock setBranchToShellMuse(World world, BlockState state) {
|
||||
|
||||
Block block = state.getBlock();
|
||||
if (block instanceof TrunkShellBlock){
|
||||
TrunkShellBlock.ShellMuse muse = ((TrunkShellBlock)block).getMuse(world, startCutPos);
|
||||
|
@ -52,10 +61,10 @@ public class DynamicTree extends AbstractBlockBreakQueue {
|
|||
return TreeHelper.getBranch(muse.state);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
public static boolean isDynamicBranch(Block block) {
|
||||
return TreeHelper.isBranch(block) || block instanceof TrunkShellBlock;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ public class BlueprintTransferHandler implements IRecipeTransferHandler<Blueprin
|
|||
|
||||
@Override
|
||||
public IRecipeTransferError transferRecipe(BlueprintContainer container, Object recipe, IRecipeLayout recipeLayout,
|
||||
Player player, boolean maxTransfer, boolean doTransfer) {
|
||||
Player player, boolean maxTransfer, boolean doTransfer) {
|
||||
if (!(recipe instanceof Recipe))
|
||||
return null;
|
||||
if (!doTransfer)
|
||||
|
|
|
@ -12,6 +12,7 @@ import com.simibubi.create.foundation.gui.GhostItemSubmitPacket;
|
|||
import com.simibubi.create.foundation.networking.AllPackets;
|
||||
|
||||
import mezz.jei.api.gui.handlers.IGhostIngredientHandler;
|
||||
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||
import net.minecraft.client.renderer.Rect2i;
|
||||
import net.minecraft.world.inventory.Slot;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
|
|
|
@ -13,13 +13,14 @@ import net.minecraft.network.chat.Component;
|
|||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
||||
public abstract class GeneratingKineticTileEntity extends KineticTileEntity {
|
||||
|
||||
public boolean reActivateSource;
|
||||
|
||||
public GeneratingKineticTileEntity(BlockEntityType<?> typeIn) {
|
||||
super(typeIn);
|
||||
public GeneratingKineticTileEntity(BlockEntityType<?> typeIn, BlockPos pos, BlockState state) {
|
||||
super(typeIn, pos, state);
|
||||
}
|
||||
|
||||
protected void notifyStressCapacityChange(float capacity) {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.simibubi.create.content.contraptions.base;
|
||||
|
||||
import static net.minecraft.util.text.TextFormatting.GOLD;
|
||||
import static net.minecraft.ChatFormatting.GOLD;
|
||||
import static net.minecraft.ChatFormatting.GRAY;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -41,7 +42,6 @@ import net.minecraft.world.level.Level;
|
|||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.entity.TickableBlockEntity;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
|
@ -49,7 +49,7 @@ import net.minecraftforge.api.distmarker.OnlyIn;
|
|||
import net.minecraftforge.fml.DistExecutor;
|
||||
|
||||
public abstract class KineticTileEntity extends SmartTileEntity
|
||||
implements TickableBlockEntity, IHaveGoggleInformation, IHaveHoveringInformation, IInstanceRendered {
|
||||
implements IHaveGoggleInformation, IHaveHoveringInformation, IInstanceRendered {
|
||||
|
||||
public @Nullable Long network;
|
||||
public @Nullable BlockPos source;
|
||||
|
@ -70,8 +70,8 @@ public abstract class KineticTileEntity extends SmartTileEntity
|
|||
protected float lastStressApplied;
|
||||
protected float lastCapacityProvided;
|
||||
|
||||
public KineticTileEntity(BlockEntityType<?> typeIn) {
|
||||
super(typeIn);
|
||||
public KineticTileEntity(BlockEntityType<?> typeIn, BlockPos pos, BlockState state) {
|
||||
super(typeIn, pos, state);
|
||||
effects = new KineticEffectHandler(this);
|
||||
updateSpeed = true;
|
||||
}
|
||||
|
@ -226,13 +226,13 @@ public abstract class KineticTileEntity extends SmartTileEntity
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void fromTag(BlockState state, CompoundTag compound, boolean clientPacket) {
|
||||
protected void fromTag(CompoundTag compound, boolean clientPacket) {
|
||||
boolean overStressedBefore = overStressed;
|
||||
clearKineticInformation();
|
||||
|
||||
// DO NOT READ kinetic information when placed after movement
|
||||
if (wasMoved) {
|
||||
super.fromTag(state, compound, clientPacket);
|
||||
super.fromTag(compound, clientPacket);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -252,7 +252,7 @@ public abstract class KineticTileEntity extends SmartTileEntity
|
|||
overStressed = capacity < stress && StressImpact.isEnabled();
|
||||
}
|
||||
|
||||
super.fromTag(state, compound, clientPacket);
|
||||
super.fromTag(compound, clientPacket);
|
||||
|
||||
if (clientPacket && overStressedBefore != overStressed && speed != 0)
|
||||
effects.triggerOverStressedEffect();
|
||||
|
@ -412,9 +412,8 @@ public abstract class KineticTileEntity extends SmartTileEntity
|
|||
tooltip.add(componentSpacing.plainCopy()
|
||||
.append(Lang.translate("tooltip.speedRequirement")
|
||||
.withStyle(GOLD)));
|
||||
Component hint =
|
||||
Lang.translate("gui.contraptions.not_fast_enough", I18n.get(getBlockState().getBlock()
|
||||
.getDescriptionId()));
|
||||
Component hint = Lang.translate("gui.contraptions.not_fast_enough", I18n.get(getBlockState().getBlock()
|
||||
.getDescriptionId()));
|
||||
List<Component> cutString = TooltipHelper.cutTextComponent(hint, GRAY, ChatFormatting.WHITE);
|
||||
for (int i = 0; i < cutString.size(); i++)
|
||||
tooltip.add(componentSpacing.plainCopy()
|
||||
|
@ -597,5 +596,4 @@ public abstract class KineticTileEntity extends SmartTileEntity
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import com.simibubi.create.AllShapes;
|
|||
import com.simibubi.create.content.contraptions.wrench.IWrenchable;
|
||||
import com.simibubi.create.foundation.utility.BlockHelper;
|
||||
|
||||
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
|
|
|
@ -30,8 +30,8 @@ public abstract class BlockBreakingKineticTileEntity extends KineticTileEntity {
|
|||
protected int breakerId = -NEXT_BREAKER_ID.incrementAndGet();
|
||||
protected BlockPos breakingPos;
|
||||
|
||||
public BlockBreakingKineticTileEntity(BlockEntityType<?> typeIn) {
|
||||
super(typeIn);
|
||||
public BlockBreakingKineticTileEntity(BlockEntityType<?> typeIn, BlockPos pos, BlockState state) {
|
||||
super(typeIn, pos, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -68,12 +68,12 @@ public abstract class BlockBreakingKineticTileEntity extends KineticTileEntity {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void fromTag(BlockState state, CompoundTag compound, boolean clientPacket) {
|
||||
protected void fromTag(CompoundTag compound, boolean clientPacket) {
|
||||
destroyProgress = compound.getInt("Progress");
|
||||
ticksUntilNextProgress = compound.getInt("NextTick");
|
||||
if (compound.contains("Breaking"))
|
||||
breakingPos = NbtUtils.readBlockPos(compound.getCompound("Breaking"));
|
||||
super.fromTag(state, compound, clientPacket);
|
||||
super.fromTag(compound, clientPacket);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -140,7 +140,7 @@ public abstract class BlockBreakingKineticTileEntity extends KineticTileEntity {
|
|||
public void onBlockBroken(BlockState stateToBreak) {
|
||||
FluidState FluidState = level.getFluidState(breakingPos);
|
||||
level.levelEvent(2001, breakingPos, Block.getId(stateToBreak));
|
||||
BlockEntity tileentity = stateToBreak.hasTileEntity() ? level.getBlockEntity(breakingPos) : null;
|
||||
BlockEntity tileentity = stateToBreak.hasBlockEntity() ? level.getBlockEntity(breakingPos) : null;
|
||||
Vec3 vec = VecHelper.offsetRandomly(VecHelper.getCenterOf(breakingPos), level.random, .125f);
|
||||
|
||||
Block.getDrops(stateToBreak, (ServerLevel) level, breakingPos, tileentity).forEach((stack) -> {
|
||||
|
|
|
@ -7,6 +7,7 @@ import com.simibubi.create.AllTileEntities;
|
|||
import com.simibubi.create.content.contraptions.base.DirectionalKineticBlock;
|
||||
import com.simibubi.create.foundation.block.ITE;
|
||||
|
||||
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.Direction.Axis;
|
||||
|
|
|
@ -1,23 +1,15 @@
|
|||
package com.simibubi.create.content.contraptions.components.actors;
|
||||
|
||||
import static net.minecraft.state.properties.BlockStateProperties.FACING;
|
||||
|
||||
import com.net.minimport com.jozufozu.flywheel.backend.instancing.Instancer;
|
||||
import com.jozufozu.flywheel.backend.instancing.Instancer;
|
||||
import com.jozufozu.flywheel.backend.material.MaterialManager;
|
||||
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
||||
import com.simibubi.create.content.contraptions.base.RotatingData;
|
||||
import com.simibubi.create.content.contraptions.base.SingleRotatingInstance;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
||||
ecraft.world.level.block.state.properties.BlockStatePropertiesport com.jozufozu.flywheel.backend.material.MaterialManager;
|
||||
import com.simibubi.create.AllBlockPartials;
|
||||
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
||||
import com.simibubi.create.content.contraptions.base.RotatingData;
|
||||
import com.simibubi.create.content.contraptions.base.SingleRotatingInstance;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
||||
|
||||
public class DrillInstance extends SingleRotatingInstance {
|
||||
|
||||
|
@ -28,7 +20,7 @@ public class DrillInstance extends SingleRotatingInstance {
|
|||
@Override
|
||||
protected Instancer<RotatingData> getModel() {
|
||||
BlockState referenceState = tile.getBlockState();
|
||||
Direction facing = referenceState.getValue(FACING);
|
||||
Direction facing = referenceState.getValue(BlockStateProperties.FACING);
|
||||
return getRotatingMaterial().getModel(AllBlockPartials.DRILL_HEAD, referenceState, facing);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,11 +2,12 @@ package com.simibubi.create.content.contraptions.components.actors;
|
|||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
||||
public class DrillTileEntity extends BlockBreakingKineticTileEntity {
|
||||
|
||||
public DrillTileEntity(BlockEntityType<? extends DrillTileEntity> type) {
|
||||
super(type);
|
||||
public DrillTileEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
|
||||
super(type, pos, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
package com.simibubi.create.content.contraptions.components.actors;
|
||||
|
||||
import static net.minecraft.state.properties.BlockStateProperties.HORIZONTAL_FACING;
|
||||
|
||||
import com.jozufozu.flywheel.backend.material.Material;
|
||||
import com.jozufozu.flywheel.backend.material.MaterialManager;
|
||||
import com.jozufozu.flywheel.core.Materials;
|
||||
import com.jozufozu.flywheel.core.materials.model.ModelData;
|
||||
import com.jozufozu.flywheel.util.transform.MatrixTransformStack;
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.simibubi.create.AllBlockPartials;
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext;
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.render.ActorInstance;
|
||||
|
@ -18,6 +16,7 @@ import com.simibubi.create.foundation.utility.worldWrappers.PlacementSimulationW
|
|||
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
|
||||
public class HarvesterActorInstance extends ActorInstance {
|
||||
|
@ -42,7 +41,7 @@ public class HarvesterActorInstance extends ActorInstance {
|
|||
|
||||
BlockState state = context.state;
|
||||
|
||||
facing = state.getValue(HORIZONTAL_FACING);
|
||||
facing = state.getValue(BlockStateProperties.HORIZONTAL_FACING);
|
||||
|
||||
harvester = material.getModel(AllBlockPartials.HARVESTER_BLADE, state).createInstance();
|
||||
|
||||
|
@ -75,7 +74,7 @@ public class HarvesterActorInstance extends ActorInstance {
|
|||
|
||||
@Override
|
||||
public void beginFrame() {
|
||||
MatrixStack ms = new MatrixStack();
|
||||
PoseStack ms = new PoseStack();
|
||||
MatrixTransformStack msr = MatrixTransformStack.of(ms);
|
||||
|
||||
msr.translate(context.localPos)
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
package com.simibubi.create.content.contraptions.components.actors;
|
||||
|
||||
import static net.minecraft.block.HorizontalBlock.FACING;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import javanet.minecrafimport com.jozufozu.flywheel.backend.Backend;
|
||||
import org.apache.commons.lang3.mutable.MutableBoolean;
|
||||
|
||||
import com.jozufozu.flywheel.backend.Backend;
|
||||
import com.jozufozu.flywheel.backend.material.MaterialManager;
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.MovementBehaviour;
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext;
|
||||
|
@ -12,7 +14,7 @@ import com.simibubi.create.foundation.config.AllConfigs;
|
|||
import com.simibubi.create.foundation.utility.BlockHelper;
|
||||
import com.simibubi.create.foundation.utility.VecHelper;
|
||||
import com.simibubi.create.foundation.utility.worldWrappers.PlacementSimulationWorld;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.tags.BlockTags;
|
||||
|
@ -32,46 +34,12 @@ import net.minecraft.world.level.block.state.properties.IntegerProperty;
|
|||
import net.minecraft.world.level.block.state.properties.Property;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import net.minecraftforge.common.IPlantable;
|
||||
import org.apache.commons.lang3.mutable.MutableBoolean;
|
||||
|
||||
t.world.level.block.HorizontalDirectionalBlockg.apache.commons.lang3.mutable.MutableBoolean;
|
||||
|
||||
import com.jozufozu.flywheel.backend.Backend;
|
||||
import com.jozufozu.flywheel.backend.material.MaterialManager;
|
||||
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;
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionMatrices;
|
||||
import com.simibubi.create.foundation.config.AllConfigs;
|
||||
import com.simibubi.create.foundation.utility.BlockHelper;
|
||||
import com.simibubi.create.foundation.utility.VecHelper;
|
||||
import com.simibubi.create.foundation.utility.worldWrappers.PlacementSimulationWorld;
|
||||
|
||||
import net.minecraft.block.AbstractPlantBlock;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.CocoaBlock;
|
||||
import net.minecraft.block.CropsBlock;
|
||||
import net.minecraft.block.SugarCaneBlock;
|
||||
import net.minecraft.block.SweetBerryBushBlock;
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.state.IntegerProperty;
|
||||
import net.minecraft.state.Property;
|
||||
import net.minecraft.state.properties.BlockStateProperties;
|
||||
import net.minecraft.tags.BlockTags;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.IPlantable;
|
||||
|
||||
public class HarvesterMovementBehaviour extends MovementBehaviour {
|
||||
|
||||
@Override
|
||||
public boolean isActive(MovementContext context) {
|
||||
return !VecHelper.isVecPointingTowards(context.relativeMotion, context.state.getValue(FACING)
|
||||
return !VecHelper.isVecPointingTowards(context.relativeMotion, context.state.getValue(HarvesterBlock.FACING)
|
||||
.getOpposite());
|
||||
}
|
||||
|
||||
|
@ -97,7 +65,7 @@ public class HarvesterMovementBehaviour extends MovementBehaviour {
|
|||
|
||||
@Override
|
||||
public Vec3 getActiveAreaOffset(MovementContext context) {
|
||||
return Vec3.atLowerCornerOf(context.state.getValue(FACING)
|
||||
return Vec3.atLowerCornerOf(context.state.getValue(HarvesterBlock.FACING)
|
||||
.getNormal())
|
||||
.scale(.45);
|
||||
}
|
||||
|
@ -121,8 +89,7 @@ public class HarvesterMovementBehaviour extends MovementBehaviour {
|
|||
ItemStack item = ItemStack.EMPTY;
|
||||
float effectChance = 1;
|
||||
|
||||
if (stateVisited.getBlock()
|
||||
.is(BlockTags.LEAVES)) {
|
||||
if (stateVisited.is(BlockTags.LEAVES)) {
|
||||
item = new ItemStack(Items.SHEARS);
|
||||
effectChance = .45f;
|
||||
}
|
||||
|
@ -144,7 +111,7 @@ public class HarvesterMovementBehaviour extends MovementBehaviour {
|
|||
private boolean isValidCrop(Level world, BlockPos pos, BlockState state) {
|
||||
boolean harvestPartial = AllConfigs.SERVER.kinetics.harvestPartiallyGrown.get();
|
||||
boolean replant = AllConfigs.SERVER.kinetics.harvesterReplants.get();
|
||||
|
||||
|
||||
if (state.getBlock() instanceof CropBlock) {
|
||||
CropBlock crop = (CropBlock) state.getBlock();
|
||||
if (harvestPartial)
|
||||
|
@ -180,8 +147,7 @@ public class HarvesterMovementBehaviour extends MovementBehaviour {
|
|||
return false;
|
||||
if (state.getBlock() instanceof SugarCaneBlock)
|
||||
return true;
|
||||
if (state.getBlock()
|
||||
.is(BlockTags.LEAVES))
|
||||
if (state.is(BlockTags.LEAVES))
|
||||
return true;
|
||||
|
||||
if (state.getCollisionShape(world, pos)
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package com.simibubi.create.content.contraptions.components.actors;
|
||||
|
||||
import static net.minecraft.block.HorizontalBlock.FACING;
|
||||
|
||||
import com.net.minecrafimport com.simibubi.create.content.contraptions.components.structureMovement.MovementContext;
|
||||
import com.simibubi.create.content.contraptions.components.actors.PloughBlock.PloughFakePlayer;
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext;
|
||||
import com.simibubi.create.foundation.utility.VecHelper;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
|
@ -25,36 +25,11 @@ import net.minecraft.world.phys.BlockHitResult;
|
|||
import net.minecraft.world.phys.HitResult.Type;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
|
||||
t.world.level.block.HorizontalDirectionalBlocks.components.actors.PloughBlock.PloughFakePlayer;
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext;
|
||||
import com.simibubi.create.foundation.utility.VecHelper;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.BubbleColumnBlock;
|
||||
import net.minecraft.block.FarmlandBlock;
|
||||
import net.minecraft.block.FlowingFluidBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemUseContext;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.loot.LootContext;
|
||||
import net.minecraft.loot.LootParameters;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.util.math.RayTraceContext;
|
||||
import net.minecraft.util.math.RayTraceContext.BlockMode;
|
||||
import net.minecraft.util.math.RayTraceContext.FluidMode;
|
||||
import net.minecraft.util.math.RayTraceResult.Type;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.server.ServerWorld;
|
||||
|
||||
public class PloughMovementBehaviour extends BlockBreakingMovementBehaviour {
|
||||
|
||||
@Override
|
||||
public boolean isActive(MovementContext context) {
|
||||
return !VecHelper.isVecPointingTowards(context.relativeMotion, context.state.getValue(FACING)
|
||||
return !VecHelper.isVecPointingTowards(context.relativeMotion, context.state.getValue(PloughBlock.FACING)
|
||||
.getOpposite());
|
||||
}
|
||||
|
||||
|
@ -74,8 +49,7 @@ public class PloughMovementBehaviour extends BlockBreakingMovementBehaviour {
|
|||
if (player == null)
|
||||
return;
|
||||
|
||||
BlockHitResult ray = world
|
||||
.clip(new ClipContext(vec, vec.add(0, -1, 0), Block.OUTLINE, Fluid.NONE, player));
|
||||
BlockHitResult ray = world.clip(new ClipContext(vec, vec.add(0, -1, 0), Block.OUTLINE, Fluid.NONE, player));
|
||||
if (ray.getType() != Type.BLOCK)
|
||||
return;
|
||||
|
||||
|
@ -85,8 +59,9 @@ public class PloughMovementBehaviour extends BlockBreakingMovementBehaviour {
|
|||
|
||||
@Override
|
||||
public Vec3 getActiveAreaOffset(MovementContext context) {
|
||||
return Vec3.atLowerCornerOf(context.state.getValue(FACING)
|
||||
.getNormal()).scale(.45);
|
||||
return Vec3.atLowerCornerOf(context.state.getValue(PloughBlock.FACING)
|
||||
.getNormal())
|
||||
.scale(.45);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -113,10 +88,11 @@ public class PloughMovementBehaviour extends BlockBreakingMovementBehaviour {
|
|||
|
||||
if (brokenState.getBlock() == Blocks.SNOW && context.world instanceof ServerLevel) {
|
||||
ServerLevel world = (ServerLevel) context.world;
|
||||
brokenState.getDrops(new LootContext.Builder(world).withParameter(LootContextParams.BLOCK_STATE, brokenState)
|
||||
.withParameter(LootContextParams.ORIGIN, Vec3.atCenterOf(pos))
|
||||
.withParameter(LootContextParams.THIS_ENTITY, getPlayer(context))
|
||||
.withParameter(LootContextParams.TOOL, new ItemStack(Items.IRON_SHOVEL)))
|
||||
brokenState
|
||||
.getDrops(new LootContext.Builder(world).withParameter(LootContextParams.BLOCK_STATE, brokenState)
|
||||
.withParameter(LootContextParams.ORIGIN, Vec3.atCenterOf(pos))
|
||||
.withParameter(LootContextParams.THIS_ENTITY, getPlayer(context))
|
||||
.withParameter(LootContextParams.TOOL, new ItemStack(Items.IRON_SHOVEL)))
|
||||
.forEach(s -> dropItem(context, s));
|
||||
}
|
||||
}
|
||||
|
@ -125,7 +101,7 @@ public class PloughMovementBehaviour extends BlockBreakingMovementBehaviour {
|
|||
public void stopMoving(MovementContext context) {
|
||||
super.stopMoving(context);
|
||||
if (context.temporaryData instanceof PloughFakePlayer)
|
||||
((PloughFakePlayer) context.temporaryData).remove();
|
||||
((PloughFakePlayer) context.temporaryData).discard();
|
||||
}
|
||||
|
||||
private PloughFakePlayer getPlayer(MovementContext context) {
|
||||
|
|
|
@ -2,8 +2,10 @@ package com.simibubi.create.content.contraptions.components.actors;
|
|||
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.Contraption;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
@ -14,8 +16,8 @@ public class PortableFluidInterfaceTileEntity extends PortableStorageInterfaceTi
|
|||
|
||||
protected LazyOptional<IFluidHandler> capability;
|
||||
|
||||
public PortableFluidInterfaceTileEntity(BlockEntityType<?> tileEntityTypeIn) {
|
||||
super(tileEntityTypeIn);
|
||||
public PortableFluidInterfaceTileEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
|
||||
super(type, pos, state);
|
||||
capability = createEmptyHandler();
|
||||
}
|
||||
|
||||
|
|
|
@ -3,9 +3,11 @@ package com.simibubi.create.content.contraptions.components.actors;
|
|||
import com.simibubi.create.content.contraptions.components.structureMovement.Contraption;
|
||||
import com.simibubi.create.foundation.item.ItemHandlerWrapper;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
import net.minecraftforge.items.IItemHandlerModifiable;
|
||||
|
@ -15,8 +17,8 @@ public class PortableItemInterfaceTileEntity extends PortableStorageInterfaceTil
|
|||
|
||||
protected LazyOptional<IItemHandlerModifiable> capability;
|
||||
|
||||
public PortableItemInterfaceTileEntity(BlockEntityType<?> tileEntityTypeIn) {
|
||||
super(tileEntityTypeIn);
|
||||
public PortableItemInterfaceTileEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
|
||||
super(type, pos, state);
|
||||
capability = LazyOptional.empty();
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ import com.simibubi.create.AllTileEntities;
|
|||
import com.simibubi.create.foundation.block.ITE;
|
||||
import com.simibubi.create.foundation.block.WrenchableDirectionalBlock;
|
||||
|
||||
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.item.context.BlockPlaceContext;
|
||||
import net.minecraft.world.level.BlockGetter;
|
||||
|
|
|
@ -8,6 +8,7 @@ import com.simibubi.create.foundation.tileEntity.SmartTileEntity;
|
|||
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
|
||||
import com.simibubi.create.foundation.utility.animation.LerpedFloat;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
|
@ -25,8 +26,8 @@ public abstract class PortableStorageInterfaceTileEntity extends SmartTileEntity
|
|||
protected boolean powered;
|
||||
protected Entity connectedEntity;
|
||||
|
||||
public PortableStorageInterfaceTileEntity(BlockEntityType<?> tileEntityTypeIn) {
|
||||
super(tileEntityTypeIn);
|
||||
public PortableStorageInterfaceTileEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
|
||||
super(type, pos, state);
|
||||
transferTimer = 0;
|
||||
connectionAnimation = LerpedFloat.linear()
|
||||
.startWithValue(0);
|
||||
|
@ -85,8 +86,8 @@ public abstract class PortableStorageInterfaceTileEntity extends SmartTileEntity
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void fromTag(BlockState state, CompoundTag compound, boolean clientPacket) {
|
||||
super.fromTag(state, compound, clientPacket);
|
||||
protected void fromTag(CompoundTag compound, boolean clientPacket) {
|
||||
super.fromTag(compound, clientPacket);
|
||||
transferTimer = compound.getInt("Timer");
|
||||
distance = compound.getFloat("Distance");
|
||||
powered = compound.getBoolean("Powered");
|
||||
|
|
|
@ -9,6 +9,7 @@ import com.simibubi.create.AllBlocks;
|
|||
import com.simibubi.create.AllShapes;
|
||||
import com.simibubi.create.foundation.utility.BlockHelper;
|
||||
|
||||
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.NonNullList;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
|
|
|
@ -3,7 +3,6 @@ package com.simibubi.create.content.contraptions.components.actors;
|
|||
import com.simibubi.create.AllEntityTypes;
|
||||
|
||||
import net.minecraft.client.renderer.culling.Frustum;
|
||||
import net.minecraft.client.renderer.entity.EntityRenderDispatcher;
|
||||
import net.minecraft.client.renderer.entity.EntityRenderer;
|
||||
import net.minecraft.client.renderer.entity.EntityRendererProvider;
|
||||
import net.minecraft.core.BlockPos;
|
||||
|
|
|
@ -16,8 +16,8 @@
|
|||
//import net.minecraft.item.ItemStack;
|
||||
//import net.minecraft.nbt.NBTUtil;
|
||||
//import net.minecraft.tileentity.TileEntity;
|
||||
//import net.minecraft.util.Direction;
|
||||
//import net.minecraft.util.Direction.Axis;
|
||||
//import net.minecraft.core.Direction;
|
||||
//import net.minecraft.core.Direction.Axis;
|
||||
//import net.minecraft.util.math.BlockPos;
|
||||
//import net.minecraft.util.math.vector.Vector3d;
|
||||
//import net.minecraft.world.World;
|
||||
|
|
|
@ -4,6 +4,7 @@ import javax.annotation.Nullable;
|
|||
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext;
|
||||
|
||||
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.BlockSource;
|
||||
import net.minecraft.core.Direction;
|
||||
|
|
|
@ -6,6 +6,7 @@ import javax.annotation.ParametersAreNonnullByDefault;
|
|||
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext;
|
||||
|
||||
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.dispenser.AbstractProjectileDispenseBehavior;
|
||||
|
|
|
@ -12,6 +12,7 @@ import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
|||
import com.simibubi.create.foundation.utility.NBTHelper;
|
||||
import com.simibubi.create.foundation.utility.VecHelper;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.particles.ParticleTypes;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.sounds.SoundEvent;
|
||||
|
@ -37,14 +38,14 @@ public class CuckooClockTileEntity extends KineticTileEntity {
|
|||
PIG, CREEPER, SURPRISE, NONE;
|
||||
}
|
||||
|
||||
public CuckooClockTileEntity(BlockEntityType<? extends CuckooClockTileEntity> type) {
|
||||
super(type);
|
||||
public CuckooClockTileEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
|
||||
super(type, pos, state);
|
||||
animationType = Animation.NONE;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void fromTag(BlockState state, CompoundTag compound, boolean clientPacket) {
|
||||
super.fromTag(state, compound, clientPacket);
|
||||
protected void fromTag(CompoundTag compound, boolean clientPacket) {
|
||||
super.fromTag(compound, clientPacket);
|
||||
if (clientPacket && compound.contains("Animation")) {
|
||||
animationType = NBTHelper.readEnum(compound, "Animation", Animation.class);
|
||||
animationProgress.lastValue = 0;
|
||||
|
|
|
@ -214,7 +214,7 @@ public class MechanicalCrafterBlock extends HorizontalKineticBlock implements IT
|
|||
crafter.setChanged();
|
||||
crafter.sendData();
|
||||
if (!player.isCreative())
|
||||
player.inventory.placeItemBackInInventory(worldIn, AllItems.CRAFTER_SLOT_COVER.asStack());
|
||||
player.getInventory().placeItemBackInInventory(worldIn, AllItems.CRAFTER_SLOT_COVER.asStack());
|
||||
return InteractionResult.SUCCESS;
|
||||
}
|
||||
return InteractionResult.PASS;
|
||||
|
@ -223,7 +223,7 @@ public class MechanicalCrafterBlock extends HorizontalKineticBlock implements IT
|
|||
return InteractionResult.PASS;
|
||||
if (worldIn.isClientSide)
|
||||
return InteractionResult.SUCCESS;
|
||||
player.inventory.placeItemBackInInventory(worldIn, inSlot);
|
||||
player.getInventory().placeItemBackInInventory(worldIn, inSlot);
|
||||
crafter.getInventory().setStackInSlot(0, ItemStack.EMPTY);
|
||||
return InteractionResult.SUCCESS;
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ import com.jozufozu.flywheel.backend.instancing.Instancer;
|
|||
import com.jozufozu.flywheel.backend.material.MaterialManager;
|
||||
import com.jozufozu.flywheel.util.transform.MatrixTransformStack;
|
||||
import com.jozufozu.flywheel.util.transform.TransformStack;
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.simibubi.create.AllBlockPartials;
|
||||
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
||||
import com.simibubi.create.content.contraptions.base.RotatingData;
|
||||
|
@ -27,9 +27,9 @@ public class MechanicalCrafterInstance extends SingleRotatingInstance {
|
|||
return getRotatingMaterial().getModel(AllBlockPartials.SHAFTLESS_COGWHEEL, blockState, facing, rotateToFace(facing));
|
||||
}
|
||||
|
||||
private Supplier<MatrixStack> rotateToFace(Direction facing) {
|
||||
private Supplier<PoseStack> rotateToFace(Direction facing) {
|
||||
return () -> {
|
||||
MatrixStack stack = new MatrixStack();
|
||||
PoseStack stack = new PoseStack();
|
||||
TransformStack stacker = MatrixTransformStack.of(stack)
|
||||
.centre();
|
||||
|
||||
|
|
|
@ -96,8 +96,8 @@ public class MechanicalCrafterTileEntity extends KineticTileEntity {
|
|||
|
||||
private ItemStack scriptedResult = ItemStack.EMPTY;
|
||||
|
||||
public MechanicalCrafterTileEntity(BlockEntityType<? extends MechanicalCrafterTileEntity> type) {
|
||||
super(type);
|
||||
public MechanicalCrafterTileEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
|
||||
super(type, pos, state);
|
||||
setLazyTickRate(20);
|
||||
phase = Phase.IDLE;
|
||||
groupedItemsBeforeCraft = new GroupedItems();
|
||||
|
@ -157,7 +157,7 @@ public class MechanicalCrafterTileEntity extends KineticTileEntity {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void fromTag(BlockState state, CompoundTag compound, boolean clientPacket) {
|
||||
protected void fromTag(CompoundTag compound, boolean clientPacket) {
|
||||
Phase phaseBefore = phase;
|
||||
GroupedItems before = this.groupedItems;
|
||||
|
||||
|
@ -172,7 +172,7 @@ public class MechanicalCrafterTileEntity extends KineticTileEntity {
|
|||
this.phase = phase;
|
||||
countDown = compound.getInt("CountDown");
|
||||
covered = compound.getBoolean("Cover");
|
||||
super.fromTag(state, compound, clientPacket);
|
||||
super.fromTag(compound, clientPacket);
|
||||
if (!clientPacket)
|
||||
return;
|
||||
if (compound.contains("Redraw"))
|
||||
|
|
|
@ -6,7 +6,7 @@ import com.jozufozu.flywheel.backend.material.MaterialManager;
|
|||
import com.jozufozu.flywheel.core.PartialModel;
|
||||
import com.jozufozu.flywheel.core.materials.model.ModelData;
|
||||
import com.jozufozu.flywheel.util.transform.MatrixTransformStack;
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.simibubi.create.content.contraptions.base.SingleRotatingInstance;
|
||||
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
||||
|
||||
|
@ -50,7 +50,7 @@ public class HandCrankInstance extends SingleRotatingInstance implements IDynami
|
|||
Direction.Axis axis = facing.getAxis();
|
||||
float angle = (tile.independentAngle + AnimationTickHolder.getPartialTicks() * tile.chasingVelocity) / 360;
|
||||
|
||||
MatrixStack ms = new MatrixStack();
|
||||
PoseStack ms = new PoseStack();
|
||||
MatrixTransformStack.of(ms)
|
||||
.translate(getInstancePosition())
|
||||
.centre()
|
||||
|
|
|
@ -5,6 +5,7 @@ import com.simibubi.create.AllSoundEvents;
|
|||
import com.simibubi.create.content.contraptions.base.GeneratingKineticTileEntity;
|
||||
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
|
@ -19,8 +20,8 @@ public class HandCrankTileEntity extends GeneratingKineticTileEntity {
|
|||
public float independentAngle;
|
||||
public float chasingVelocity;
|
||||
|
||||
public HandCrankTileEntity(BlockEntityType<? extends HandCrankTileEntity> type) {
|
||||
super(type);
|
||||
public HandCrankTileEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
|
||||
super(type, pos, state);
|
||||
}
|
||||
|
||||
public void turn(boolean back) {
|
||||
|
@ -52,9 +53,9 @@ public class HandCrankTileEntity extends GeneratingKineticTileEntity {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void fromTag(BlockState state, CompoundTag compound, boolean clientPacket) {
|
||||
protected void fromTag(CompoundTag compound, boolean clientPacket) {
|
||||
inUse = compound.getInt("InUse");
|
||||
super.fromTag(state, compound, clientPacket);
|
||||
super.fromTag(compound, clientPacket);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package com.simibubi.create.content.contraptions.components.crusher;
|
||||
|
||||
import static com.simibubi.create.content.contraptions.components.crusher.CrushingWheelControllerBlock.VALID;
|
||||
import static net.minecraft.block.DirectionalBlock.FACING;
|
||||
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.AllShapes;
|
||||
|
@ -47,8 +46,7 @@ public class CrushingWheelBlock extends RotatedPillarKineticBlock implements ITE
|
|||
}
|
||||
|
||||
@Override
|
||||
public VoxelShape getCollisionShape(BlockState state, BlockGetter worldIn, BlockPos pos,
|
||||
CollisionContext context) {
|
||||
public VoxelShape getCollisionShape(BlockState state, BlockGetter worldIn, BlockPos pos, CollisionContext context) {
|
||||
return AllShapes.CRUSHING_WHEEL_COLLISION_SHAPE;
|
||||
}
|
||||
|
||||
|
@ -62,7 +60,7 @@ public class CrushingWheelBlock extends RotatedPillarKineticBlock implements ITE
|
|||
worldIn.setBlockAndUpdate(pos.relative(d), Blocks.AIR.defaultBlockState());
|
||||
}
|
||||
|
||||
if (state.hasTileEntity() && state.getBlock() != newState.getBlock()) {
|
||||
if (state.hasBlockEntity() && state.getBlock() != newState.getBlock()) {
|
||||
worldIn.removeBlockEntity(pos);
|
||||
}
|
||||
}
|
||||
|
@ -78,11 +76,9 @@ public class CrushingWheelBlock extends RotatedPillarKineticBlock implements ITE
|
|||
|
||||
boolean controllerExists = AllBlocks.CRUSHING_WHEEL_CONTROLLER.has(world.getBlockState(controllerPos));
|
||||
boolean controllerIsValid = controllerExists && world.getBlockState(controllerPos)
|
||||
.getValue(VALID);
|
||||
Direction controllerOldDirection = controllerExists
|
||||
? world.getBlockState(controllerPos)
|
||||
.getValue(FACING)
|
||||
: null;
|
||||
.getValue(VALID);
|
||||
Direction controllerOldDirection = controllerExists ? world.getBlockState(controllerPos)
|
||||
.getValue(CrushingWheelControllerBlock.FACING) : null;
|
||||
|
||||
boolean controllerShouldExist = false;
|
||||
boolean controllerShouldBeValid = false;
|
||||
|
@ -96,20 +92,17 @@ public class CrushingWheelBlock extends RotatedPillarKineticBlock implements ITE
|
|||
CrushingWheelTileEntity otherTe = getTileEntity(world, otherWheelPos);
|
||||
|
||||
if (te != null && otherTe != null && (te.getSpeed() > 0) != (otherTe.getSpeed() > 0)
|
||||
&& te.getSpeed() != 0) {
|
||||
&& te.getSpeed() != 0) {
|
||||
Axis wheelAxis = state.getValue(AXIS);
|
||||
Axis sideAxis = side.getAxis();
|
||||
int controllerADO = Math.round(Math.signum(te.getSpeed())) * side.getAxisDirection().getStep();
|
||||
Vec3 controllerDirVec = new Vec3(wheelAxis == Axis.X ? 1 : 0
|
||||
, wheelAxis == Axis.Y ? 1 : 0
|
||||
, wheelAxis == Axis.Z ? 1 : 0)
|
||||
.cross(new Vec3(sideAxis == Axis.X ? 1 : 0
|
||||
, sideAxis == Axis.Y ? 1 : 0
|
||||
, sideAxis == Axis.Z ? 1 : 0));
|
||||
int controllerADO = Math.round(Math.signum(te.getSpeed())) * side.getAxisDirection()
|
||||
.getStep();
|
||||
Vec3 controllerDirVec = new Vec3(wheelAxis == Axis.X ? 1 : 0, wheelAxis == Axis.Y ? 1 : 0,
|
||||
wheelAxis == Axis.Z ? 1 : 0).cross(
|
||||
new Vec3(sideAxis == Axis.X ? 1 : 0, sideAxis == Axis.Y ? 1 : 0, sideAxis == Axis.Z ? 1 : 0));
|
||||
|
||||
controllerNewDirection = Direction.getNearest(controllerDirVec.x * controllerADO
|
||||
, controllerDirVec.y * controllerADO
|
||||
, controllerDirVec.z * controllerADO);
|
||||
controllerNewDirection = Direction.getNearest(controllerDirVec.x * controllerADO,
|
||||
controllerDirVec.y * controllerADO, controllerDirVec.z * controllerADO);
|
||||
|
||||
controllerShouldBeValid = true;
|
||||
}
|
||||
|
@ -125,20 +118,20 @@ public class CrushingWheelBlock extends RotatedPillarKineticBlock implements ITE
|
|||
|
||||
if (!controllerExists) {
|
||||
if (!world.getBlockState(controllerPos)
|
||||
.getMaterial()
|
||||
.isReplaceable())
|
||||
.getMaterial()
|
||||
.isReplaceable())
|
||||
return;
|
||||
world.setBlockAndUpdate(controllerPos, AllBlocks.CRUSHING_WHEEL_CONTROLLER.getDefaultState()
|
||||
.setValue(VALID, controllerShouldBeValid)
|
||||
.setValue(FACING, controllerNewDirection));
|
||||
.setValue(VALID, controllerShouldBeValid)
|
||||
.setValue(CrushingWheelControllerBlock.FACING, controllerNewDirection));
|
||||
} else if (controllerIsValid != controllerShouldBeValid || controllerOldDirection != controllerNewDirection) {
|
||||
world.setBlockAndUpdate(controllerPos, world.getBlockState(controllerPos)
|
||||
.setValue(VALID, controllerShouldBeValid)
|
||||
.setValue(FACING, controllerNewDirection));
|
||||
.setValue(VALID, controllerShouldBeValid)
|
||||
.setValue(CrushingWheelControllerBlock.FACING, controllerNewDirection));
|
||||
}
|
||||
|
||||
((CrushingWheelControllerBlock) AllBlocks.CRUSHING_WHEEL_CONTROLLER.get())
|
||||
.updateSpeed(world.getBlockState(controllerPos), world, controllerPos);
|
||||
.updateSpeed(world.getBlockState(controllerPos), world, controllerPos);
|
||||
|
||||
}
|
||||
|
||||
|
@ -148,7 +141,7 @@ public class CrushingWheelBlock extends RotatedPillarKineticBlock implements ITE
|
|||
return;
|
||||
|
||||
float speed = getTileEntityOptional(worldIn, pos).map(CrushingWheelTileEntity::getSpeed)
|
||||
.orElse(0f);
|
||||
.orElse(0f);
|
||||
|
||||
double x = 0;
|
||||
double z = 0;
|
||||
|
@ -162,7 +155,7 @@ public class CrushingWheelBlock extends RotatedPillarKineticBlock implements ITE
|
|||
z += (pos.getZ() + .5f - entityIn.getZ()) * .1f;
|
||||
}
|
||||
entityIn.setDeltaMovement(entityIn.getDeltaMovement()
|
||||
.add(x, 0, z));
|
||||
.add(x, 0, z));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,8 +1,12 @@
|
|||
package com.simibubi.create.content.contraptions.components.crusher;
|
||||
|
||||
import static net.minecraft.block.DirectionalBlock.FACING;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.Random;
|
||||
import java.util.UUID;
|
||||
|
||||
import javanimport com.simibubi.create.AllRecipeTypes;
|
||||
import com.simibubi.create.AllRecipeTypes;
|
||||
import com.simibubi.create.content.contraptions.processing.ProcessingInventory;
|
||||
import com.simibubi.create.content.contraptions.processing.ProcessingRecipe;
|
||||
import com.simibubi.create.foundation.config.AllConfigs;
|
||||
|
@ -14,11 +18,7 @@ import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
|
|||
import com.simibubi.create.foundation.tileEntity.behaviour.belt.DirectBeltInputBehaviour;
|
||||
import com.simibubi.create.foundation.utility.NBTHelper;
|
||||
import com.simibubi.create.foundation.utility.VecHelper;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.Random;
|
||||
import java.util.UUID;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.Direction.Axis;
|
||||
|
@ -47,52 +47,6 @@ import net.minecraftforge.items.CapabilityItemHandler;
|
|||
import net.minecraftforge.items.IItemHandlerModifiable;
|
||||
import net.minecraftforge.items.wrapper.RecipeWrapper;
|
||||
|
||||
et.minecraft.world.level.block.DirectionalBlockist;
|
||||
import java.util.Optional;
|
||||
import java.util.Random;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.simibubi.create.AllRecipeTypes;
|
||||
import com.simibubi.create.content.contraptions.processing.ProcessingInventory;
|
||||
import com.simibubi.create.content.contraptions.processing.ProcessingRecipe;
|
||||
import com.simibubi.create.foundation.config.AllConfigs;
|
||||
import com.simibubi.create.foundation.item.ItemHelper;
|
||||
import com.simibubi.create.foundation.sound.SoundScapes;
|
||||
import com.simibubi.create.foundation.sound.SoundScapes.AmbienceGroup;
|
||||
import com.simibubi.create.foundation.tileEntity.SmartTileEntity;
|
||||
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
|
||||
import com.simibubi.create.foundation.tileEntity.behaviour.belt.DirectBeltInputBehaviour;
|
||||
import com.simibubi.create.foundation.utility.NBTHelper;
|
||||
import com.simibubi.create.foundation.utility.VecHelper;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.item.ItemEntity;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.nbt.NBTUtil;
|
||||
import net.minecraft.particles.BlockParticleData;
|
||||
import net.minecraft.particles.IParticleData;
|
||||
import net.minecraft.particles.ItemParticleData;
|
||||
import net.minecraft.particles.ParticleTypes;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Direction.Axis;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
import net.minecraftforge.fml.DistExecutor;
|
||||
import net.minecraftforge.items.CapabilityItemHandler;
|
||||
import net.minecraftforge.items.IItemHandlerModifiable;
|
||||
import net.minecraftforge.items.wrapper.RecipeWrapper;
|
||||
|
||||
public class CrushingWheelControllerTileEntity extends SmartTileEntity {
|
||||
|
||||
public Entity processingEntity;
|
||||
|
@ -104,8 +58,8 @@ public class CrushingWheelControllerTileEntity extends SmartTileEntity {
|
|||
private RecipeWrapper wrapper;
|
||||
public float crushingspeed;
|
||||
|
||||
public CrushingWheelControllerTileEntity(BlockEntityType<? extends CrushingWheelControllerTileEntity> type) {
|
||||
super(type);
|
||||
public CrushingWheelControllerTileEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
|
||||
super(type, pos, state);
|
||||
inventory = new ProcessingInventory(this::itemInserted) {
|
||||
|
||||
@Override
|
||||
|
@ -154,7 +108,7 @@ public class CrushingWheelControllerTileEntity extends SmartTileEntity {
|
|||
float speed = crushingspeed * 4;
|
||||
|
||||
Vec3 centerPos = VecHelper.getCenterOf(worldPosition);
|
||||
Direction facing = getBlockState().getValue(FACING);
|
||||
Direction facing = getBlockState().getValue(CrushingWheelControllerBlock.FACING);
|
||||
int offset = facing.getAxisDirection()
|
||||
.getStep();
|
||||
Vec3 outSpeed = new Vec3((facing.getAxis() == Axis.X ? 0.25D : 0.0D) * offset,
|
||||
|
@ -315,7 +269,7 @@ public class CrushingWheelControllerTileEntity extends SmartTileEntity {
|
|||
inventory.setStackInSlot(0, itemEntity.getItem()
|
||||
.copy());
|
||||
itemInserted(inventory.getStackInSlot(0));
|
||||
itemEntity.remove();
|
||||
itemEntity.discard();
|
||||
level.sendBlockUpdated(worldPosition, getBlockState(), getBlockState(), 2 | 16);
|
||||
}
|
||||
|
||||
|
@ -377,8 +331,8 @@ public class CrushingWheelControllerTileEntity extends SmartTileEntity {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void fromTag(BlockState state, CompoundTag compound, boolean clientPacket) {
|
||||
super.fromTag(state, compound, clientPacket);
|
||||
protected void fromTag(CompoundTag compound, boolean clientPacket) {
|
||||
super.fromTag(compound, clientPacket);
|
||||
if (compound.contains("Entity") && !isOccupied()) {
|
||||
entityUUID = NbtUtils.loadUUID(NBTHelper.getINBT(compound, "Entity"));
|
||||
this.searchForEntity = true;
|
||||
|
|
|
@ -3,10 +3,12 @@ package com.simibubi.create.content.contraptions.components.crusher;
|
|||
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
||||
import com.simibubi.create.foundation.utility.Iterate;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.damagesource.DamageSource;
|
||||
import net.minecraft.world.entity.item.ItemEntity;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import net.minecraftforge.event.entity.living.LivingDropsEvent;
|
||||
|
@ -20,8 +22,8 @@ public class CrushingWheelTileEntity extends KineticTileEntity {
|
|||
public static DamageSource damageSource = new DamageSource("create.crush").bypassArmor()
|
||||
.setScalesWithDifficulty();
|
||||
|
||||
public CrushingWheelTileEntity(BlockEntityType<? extends CrushingWheelTileEntity> type) {
|
||||
super(type);
|
||||
public CrushingWheelTileEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
|
||||
super(type, pos, state);
|
||||
setLazyTickRate(20);
|
||||
}
|
||||
|
||||
|
|
|
@ -9,8 +9,7 @@ import com.jozufozu.flywheel.core.Materials;
|
|||
import com.jozufozu.flywheel.core.PartialModel;
|
||||
import com.jozufozu.flywheel.core.materials.model.ModelData;
|
||||
import com.jozufozu.flywheel.util.transform.MatrixTransformStack;
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.math.Vector3d;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.simibubi.create.AllBlockPartials;
|
||||
import com.simibubi.create.content.contraptions.base.IRotate;
|
||||
import com.simibubi.create.content.contraptions.base.KineticTileInstance;
|
||||
|
@ -26,8 +25,9 @@ import com.simibubi.create.foundation.utility.worldWrappers.PlacementSimulationW
|
|||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
|
||||
public class DeployerActorInstance extends ActorInstance {
|
||||
|
||||
|
@ -83,18 +83,18 @@ public class DeployerActorInstance extends ActorInstance {
|
|||
public void beginFrame() {
|
||||
double factor;
|
||||
if (context.contraption.stalled || context.position == null || context.data.contains("StationaryTimer")) {
|
||||
factor = MathHelper.sin(AnimationTickHolder.getRenderTime() * .5f) * .25f + .25f;
|
||||
factor = Mth.sin(AnimationTickHolder.getRenderTime() * .5f) * .25f + .25f;
|
||||
} else {
|
||||
Vector3d center = VecHelper.getCenterOf(new BlockPos(context.position));
|
||||
Vec3 center = VecHelper.getCenterOf(new BlockPos(context.position));
|
||||
double distance = context.position.distanceTo(center);
|
||||
double nextDistance = context.position.add(context.motion)
|
||||
.distanceTo(center);
|
||||
factor = .5f - MathHelper.clamp(MathHelper.lerp(AnimationTickHolder.getPartialTicks(), distance, nextDistance), 0, 1);
|
||||
factor = .5f - Mth.clamp(Mth.lerp(AnimationTickHolder.getPartialTicks(), distance, nextDistance), 0, 1);
|
||||
}
|
||||
|
||||
Vector3d offset = Vector3d.atLowerCornerOf(facing.getNormal()).scale(factor);
|
||||
Vec3 offset = Vec3.atLowerCornerOf(facing.getNormal()).scale(factor);
|
||||
|
||||
MatrixStack ms = new MatrixStack();
|
||||
PoseStack ms = new PoseStack();
|
||||
MatrixTransformStack msr = MatrixTransformStack.of(ms);
|
||||
|
||||
msr.translate(context.localPos)
|
||||
|
|
|
@ -11,6 +11,7 @@ import com.simibubi.create.foundation.block.ITE;
|
|||
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
|
||||
import com.simibubi.create.foundation.tileEntity.behaviour.filtering.FilteringBehaviour;
|
||||
|
||||
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
|
@ -68,7 +69,7 @@ public class DeployerBlock extends DirectionalAxisKineticBlock implements ITE<De
|
|||
if (state.hasTileEntity() && state.getBlock() != newState.getBlock()) {
|
||||
withTileEntityDo(worldIn, pos, te -> {
|
||||
if (te.player != null && !isMoving) {
|
||||
te.player.inventory.dropAll();
|
||||
te.player.getInventory().dropAll();
|
||||
te.overflowItems.forEach(itemstack -> te.player.drop(itemstack, true, false));
|
||||
te.player.remove();
|
||||
te.player = null;
|
||||
|
|
|
@ -108,7 +108,7 @@ public class DeployerFakePlayer extends FakePlayer {
|
|||
if (trueSource != null && trueSource instanceof DeployerFakePlayer) {
|
||||
DeployerFakePlayer fakePlayer = (DeployerFakePlayer) trueSource;
|
||||
event.getDrops()
|
||||
.forEach(stack -> fakePlayer.inventory.placeItemBackInInventory(trueSource.level, stack.getItem()));
|
||||
.forEach(stack -> fakeplayer.getInventory().placeItemBackInInventory(trueSource.level, stack.getItem()));
|
||||
event.setCanceled(true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -123,8 +123,7 @@ public class DeployerHandler {
|
|||
return true;
|
||||
}
|
||||
|
||||
static void activate(DeployerFakePlayer player, Vec3 vec, BlockPos clickedPos, Vec3 extensionVector,
|
||||
Mode mode) {
|
||||
static void activate(DeployerFakePlayer player, Vec3 vec, BlockPos clickedPos, Vec3 extensionVector, Mode mode) {
|
||||
Multimap<Attribute, AttributeModifier> attributeModifiers = player.getMainHandItem()
|
||||
.getAttributeModifiers(EquipmentSlot.MAINHAND);
|
||||
player.getAttributes()
|
||||
|
@ -134,8 +133,8 @@ public class DeployerHandler {
|
|||
.addTransientAttributeModifiers(attributeModifiers);
|
||||
}
|
||||
|
||||
private static void activateInner(DeployerFakePlayer player, Vec3 vec, BlockPos clickedPos,
|
||||
Vec3 extensionVector, Mode mode) {
|
||||
private static void activateInner(DeployerFakePlayer player, Vec3 vec, BlockPos clickedPos, Vec3 extensionVector,
|
||||
Mode mode) {
|
||||
|
||||
Vec3 rayOrigin = vec.add(extensionVector.scale(3 / 2f + 1 / 64f));
|
||||
Vec3 rayTarget = vec.add(extensionVector.scale(5 / 2f - 1 / 64f));
|
||||
|
@ -146,7 +145,8 @@ public class DeployerHandler {
|
|||
|
||||
// Check for entities
|
||||
final ServerLevel world = player.getLevel();
|
||||
List<Entity> entities = world.getEntitiesOfClass(Entity.class, new AABB(clickedPos)).stream()
|
||||
List<Entity> entities = world.getEntitiesOfClass(Entity.class, new AABB(clickedPos))
|
||||
.stream()
|
||||
.filter(e -> !(e instanceof AbstractContraptionEntity))
|
||||
.collect(Collectors.toList());
|
||||
InteractionHand hand = InteractionHand.MAIN_HAND;
|
||||
|
@ -165,16 +165,16 @@ public class DeployerHandler {
|
|||
}
|
||||
if (cancelResult == null) {
|
||||
if (entity.interact(player, hand)
|
||||
.consumesAction()){
|
||||
.consumesAction()) {
|
||||
if (entity instanceof AbstractVillager) {
|
||||
AbstractVillager villager = ((AbstractVillager) entity);
|
||||
if (villager.getTradingPlayer() instanceof DeployerFakePlayer)
|
||||
villager.setTradingPlayer(null);
|
||||
}
|
||||
success = true;
|
||||
}
|
||||
else if (entity instanceof LivingEntity && stack.interactLivingEntity(player, (LivingEntity) entity, hand)
|
||||
.consumesAction())
|
||||
} else if (entity instanceof LivingEntity
|
||||
&& stack.interactLivingEntity(player, (LivingEntity) entity, hand)
|
||||
.consumesAction())
|
||||
success = true;
|
||||
}
|
||||
if (!success && stack.isEdible() && entity instanceof Player) {
|
||||
|
@ -196,14 +196,15 @@ public class DeployerHandler {
|
|||
}
|
||||
|
||||
entity.captureDrops(null);
|
||||
capturedDrops.forEach(e -> player.inventory.placeItemBackInInventory(world, e.getItem()));
|
||||
capturedDrops.forEach(e -> player.getInventory()
|
||||
.placeItemBackInInventory(e.getItem()));
|
||||
if (success)
|
||||
return;
|
||||
}
|
||||
|
||||
// Shoot ray
|
||||
ClipContext rayTraceContext =
|
||||
new ClipContext(rayOrigin, rayTarget, Block.OUTLINE, Fluid.NONE, player);
|
||||
new ClipContext(rayOrigin, rayTarget, ClipContext.Block.OUTLINE, ClipContext.Fluid.NONE, player);
|
||||
BlockHitResult result = world.clip(rayTraceContext);
|
||||
if (result.getBlockPos() != clickedPos)
|
||||
result = new BlockHitResult(result.getLocation(), result.getDirection(), clickedPos, result.isInside());
|
||||
|
@ -225,7 +226,8 @@ public class DeployerHandler {
|
|||
LeftClickBlock event = ForgeHooks.onLeftClickBlock(player, clickedPos, face);
|
||||
if (event.isCanceled())
|
||||
return;
|
||||
if (BlockHelper.extinguishFire(world, player, clickedPos, face)) // FIXME: is there an equivalent in world, as there was in 1.15?
|
||||
if (BlockHelper.extinguishFire(world, player, clickedPos, face)) // FIXME: is there an equivalent in world,
|
||||
// as there was in 1.15?
|
||||
return;
|
||||
if (event.getUseBlock() != DENY)
|
||||
clickedState.attack(world, clickedPos, player);
|
||||
|
@ -242,7 +244,7 @@ public class DeployerHandler {
|
|||
.getHitSound(), SoundSource.NEUTRAL, .25f, 1);
|
||||
|
||||
if (progress >= 1) {
|
||||
tryHarvestBlock(player.gameMode, clickedPos);
|
||||
tryHarvestBlock(player, player.gameMode, clickedPos);
|
||||
world.destroyBlockProgress(player.getId(), clickedPos, -1);
|
||||
player.blockBreakingProgress = null;
|
||||
return;
|
||||
|
@ -289,8 +291,7 @@ public class DeployerHandler {
|
|||
return;
|
||||
if (useItem == DENY)
|
||||
return;
|
||||
if (item instanceof BlockItem
|
||||
&& !(item instanceof CartAssemblerBlockItem)
|
||||
if (item instanceof BlockItem && !(item instanceof CartAssemblerBlockItem)
|
||||
&& !clickedState.canBeReplaced(new BlockPlaceContext(itemusecontext)))
|
||||
return;
|
||||
|
||||
|
@ -338,11 +339,10 @@ public class DeployerHandler {
|
|||
player.stopUsingItem();
|
||||
}
|
||||
|
||||
public static boolean tryHarvestBlock(ServerPlayerGameMode interactionManager, BlockPos pos) {
|
||||
public static boolean tryHarvestBlock(ServerPlayer player, ServerPlayerGameMode interactionManager, BlockPos pos) {
|
||||
// <> PlayerInteractionManager#tryHarvestBlock
|
||||
|
||||
ServerLevel world = interactionManager.level;
|
||||
ServerPlayer player = interactionManager.player;
|
||||
ServerLevel world = player.getLevel();
|
||||
BlockState blockstate = world.getBlockState(pos);
|
||||
GameType gameType = interactionManager.getGameModeForPlayer();
|
||||
|
||||
|
@ -364,14 +364,12 @@ public class DeployerHandler {
|
|||
if (prevHeldItem.isEmpty() && !heldItem.isEmpty())
|
||||
net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(player, heldItem, InteractionHand.MAIN_HAND);
|
||||
|
||||
|
||||
BlockPos posUp = pos.above();
|
||||
BlockState stateUp = world.getBlockState(posUp);
|
||||
if (blockstate.getBlock() instanceof DoublePlantBlock
|
||||
&& blockstate.getValue(DoublePlantBlock.HALF) == DoubleBlockHalf.LOWER
|
||||
&& stateUp.getBlock() == blockstate.getBlock()
|
||||
&& stateUp.getValue(DoublePlantBlock.HALF) == DoubleBlockHalf.UPPER
|
||||
) {
|
||||
&& stateUp.getValue(DoublePlantBlock.HALF) == DoubleBlockHalf.UPPER) {
|
||||
// hack to prevent DoublePlantBlock from dropping a duplicate item
|
||||
world.setBlock(pos, Blocks.AIR.defaultBlockState(), 35);
|
||||
world.setBlock(posUp, Blocks.AIR.defaultBlockState(), 35);
|
||||
|
@ -386,7 +384,7 @@ public class DeployerHandler {
|
|||
return true;
|
||||
|
||||
Block.getDrops(blockstate, world, pos, tileentity, player, prevHeldItem)
|
||||
.forEach(item -> player.inventory.placeItemBackInInventory(world, item));
|
||||
.forEach(item -> player.getInventory().placeItemBackInInventory(item));
|
||||
blockstate.spawnAfterBreak(world, pos, prevHeldItem);
|
||||
return true;
|
||||
}
|
||||
|
@ -413,7 +411,7 @@ public class DeployerHandler {
|
|||
world.playSound(player, player.getX(), player.getY(), player.getZ(), SoundEvents.BEEHIVE_SHEAR,
|
||||
SoundSource.NEUTRAL, 1.0F, 1.0F);
|
||||
// <> BeehiveBlock#dropHoneycomb
|
||||
player.inventory.placeItemBackInInventory(world, new ItemStack(Items.HONEYCOMB, 3));
|
||||
player.getInventory().placeItemBackInInventory(new ItemStack(Items.HONEYCOMB, 3));
|
||||
prevHeldItem.hurtAndBreak(1, player, s -> s.broadcastBreakEvent(hand));
|
||||
success = true;
|
||||
}
|
||||
|
@ -426,7 +424,7 @@ public class DeployerHandler {
|
|||
if (prevHeldItem.isEmpty())
|
||||
player.setItemInHand(hand, honeyBottle);
|
||||
else
|
||||
player.inventory.placeItemBackInInventory(world, honeyBottle);
|
||||
player.getInventory().placeItemBackInInventory(honeyBottle);
|
||||
success = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -17,8 +17,8 @@ import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
|||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.Vec3i;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.util.math.vector.Vector3i;
|
||||
|
||||
public class DeployerInstance extends ShaftInstance implements IDynamicInstance, ITickableInstance {
|
||||
|
||||
|
@ -117,8 +117,8 @@ public class DeployerInstance extends ShaftInstance implements IDynamicInstance,
|
|||
private void updatePosition() {
|
||||
float handLength = currentHand == AllBlockPartials.DEPLOYER_HAND_POINTING ? 0
|
||||
: currentHand == AllBlockPartials.DEPLOYER_HAND_HOLDING ? 4 / 16f : 3 / 16f;
|
||||
float distance = Math.min(MathHelper.clamp(progress, 0, 1) * (tile.reach + handLength), 21 / 16f);
|
||||
Vector3i facingVec = facing.getNormal();
|
||||
float distance = Math.min(Mth.clamp(progress, 0, 1) * (tile.reach + handLength), 21 / 16f);
|
||||
Vec3i facingVec = facing.getNormal();
|
||||
BlockPos blockPos = getInstancePosition();
|
||||
|
||||
float x = blockPos.getX() + ((float) facingVec.getX()) * distance;
|
||||
|
|
|
@ -83,8 +83,8 @@ public class DeployerMovementBehaviour extends MovementBehaviour {
|
|||
.getNormal());
|
||||
facingVec = context.rotation.apply(facingVec);
|
||||
Vec3 vec = context.position.subtract(facingVec.scale(2));
|
||||
player.yRot = AbstractContraptionEntity.yawFromVector(facingVec);
|
||||
player.xRot = AbstractContraptionEntity.pitchFromVector(facingVec) - 90;
|
||||
player.setYRot(AbstractContraptionEntity.yawFromVector(facingVec));
|
||||
player.setXRot(AbstractContraptionEntity.pitchFromVector(facingVec) - 90);
|
||||
|
||||
DeployerHandler.activate(player, vec, pos, facingVec, mode);
|
||||
}
|
||||
|
@ -183,8 +183,8 @@ public class DeployerMovementBehaviour extends MovementBehaviour {
|
|||
if (player == null)
|
||||
return;
|
||||
|
||||
context.tileData.put("Inventory", player.inventory.save(new ListTag()));
|
||||
player.remove();
|
||||
context.tileData.put("Inventory", player.getInventory().save(new ListTag()));
|
||||
player.discard();
|
||||
}
|
||||
|
||||
private void tryGrabbingItem(MovementContext context) {
|
||||
|
@ -206,7 +206,7 @@ public class DeployerMovementBehaviour extends MovementBehaviour {
|
|||
DeployerFakePlayer player = getPlayer(context);
|
||||
if (player == null)
|
||||
return;
|
||||
Inventory inv = player.inventory;
|
||||
Inventory inv = player.getInventory();
|
||||
ItemStack filter = getFilter(context);
|
||||
|
||||
for (List<ItemStack> list : Arrays.asList(inv.armor, inv.offhand, inv.items)) {
|
||||
|
@ -237,7 +237,7 @@ public class DeployerMovementBehaviour extends MovementBehaviour {
|
|||
private DeployerFakePlayer getPlayer(MovementContext context) {
|
||||
if (!(context.temporaryData instanceof DeployerFakePlayer) && context.world instanceof ServerLevel) {
|
||||
DeployerFakePlayer deployerFakePlayer = new DeployerFakePlayer((ServerLevel) context.world);
|
||||
deployerFakePlayer.inventory.load(context.tileData.getList("Inventory", NBT.TAG_COMPOUND));
|
||||
deployerFakePlayer.getInventory().load(context.tileData.getList("Inventory", NBT.TAG_COMPOUND));
|
||||
if (context.data.contains("HeldItem"))
|
||||
deployerFakePlayer.setItemInHand(InteractionHand.MAIN_HAND, ItemStack.of(context.data.getCompound("HeldItem")));
|
||||
context.tileData.remove("Inventory");
|
||||
|
|
|
@ -55,7 +55,7 @@ public class DeployerMovingInteraction extends MovingInteractionBehaviour {
|
|||
|
||||
if (!(ctx.temporaryData instanceof DeployerFakePlayer) && ctx.world instanceof ServerLevel) {
|
||||
DeployerFakePlayer deployerFakePlayer = new DeployerFakePlayer((ServerLevel) ctx.world);
|
||||
deployerFakePlayer.inventory.load(ctx.tileData.getList("Inventory", Constants.NBT.TAG_COMPOUND));
|
||||
deployerFakeplayer.getInventory().load(ctx.tileData.getList("Inventory", Constants.NBT.TAG_COMPOUND));
|
||||
ctx.temporaryData = fake = deployerFakePlayer;
|
||||
ctx.tileData.remove("Inventory");
|
||||
} else
|
||||
|
|
|
@ -35,6 +35,7 @@ import net.minecraft.server.level.ServerPlayer;
|
|||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.Container;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.entity.player.Inventory;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.crafting.Recipe;
|
||||
import net.minecraft.world.level.ClipContext;
|
||||
|
@ -81,9 +82,9 @@ public class DeployerTileEntity extends KineticTileEntity {
|
|||
PUNCH, USE
|
||||
}
|
||||
|
||||
public DeployerTileEntity(BlockEntityType<? extends DeployerTileEntity> type) {
|
||||
super(type);
|
||||
state = State.WAITING;
|
||||
public DeployerTileEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
|
||||
super(type, pos, state);
|
||||
this.state = State.WAITING;
|
||||
mode = Mode.USE;
|
||||
heldItem = ItemStack.EMPTY;
|
||||
redstoneLocked = false;
|
||||
|
@ -108,7 +109,8 @@ public class DeployerTileEntity extends KineticTileEntity {
|
|||
if (!level.isClientSide) {
|
||||
player = new DeployerFakePlayer((ServerLevel) level);
|
||||
if (deferredInventoryList != null) {
|
||||
player.inventory.load(deferredInventoryList);
|
||||
player.getInventory()
|
||||
.load(deferredInventoryList);
|
||||
deferredInventoryList = null;
|
||||
heldItem = player.getMainHandItem();
|
||||
sendData();
|
||||
|
@ -156,15 +158,16 @@ public class DeployerTileEntity extends KineticTileEntity {
|
|||
}
|
||||
|
||||
boolean changed = false;
|
||||
for (int i = 0; i < player.inventory.getContainerSize(); i++) {
|
||||
Inventory inventory = player.getInventory();
|
||||
for (int i = 0; i < inventory.getContainerSize(); i++) {
|
||||
if (overflowItems.size() > 10)
|
||||
break;
|
||||
ItemStack item = player.inventory.getItem(i);
|
||||
ItemStack item = inventory.getItem(i);
|
||||
if (item.isEmpty())
|
||||
continue;
|
||||
if (item != stack || !filtering.test(item)) {
|
||||
overflowItems.add(item);
|
||||
player.inventory.setItem(i, ItemStack.EMPTY);
|
||||
inventory.setItem(i, ItemStack.EMPTY);
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
|
@ -176,7 +179,8 @@ public class DeployerTileEntity extends KineticTileEntity {
|
|||
}
|
||||
|
||||
Direction facing = getBlockState().getValue(FACING);
|
||||
if (mode == Mode.USE && !DeployerHandler.shouldActivate(stack, level, worldPosition.relative(facing, 2), facing)) {
|
||||
if (mode == Mode.USE
|
||||
&& !DeployerHandler.shouldActivate(stack, level, worldPosition.relative(facing, 2), facing)) {
|
||||
timer = getTimerSpeed() * 10;
|
||||
return;
|
||||
}
|
||||
|
@ -218,8 +222,7 @@ public class DeployerTileEntity extends KineticTileEntity {
|
|||
.add(movementVector.scale(3 / 2f));
|
||||
Vec3 rayTarget = VecHelper.getCenterOf(worldPosition)
|
||||
.add(movementVector.scale(5 / 2f));
|
||||
ClipContext rayTraceContext =
|
||||
new ClipContext(rayOrigin, rayTarget, Block.OUTLINE, Fluid.NONE, player);
|
||||
ClipContext rayTraceContext = new ClipContext(rayOrigin, rayTarget, Block.OUTLINE, Fluid.NONE, player);
|
||||
BlockHitResult result = level.clip(rayTraceContext);
|
||||
reach = (float) (.5f + Math.min(result.getLocation()
|
||||
.subtract(rayOrigin)
|
||||
|
@ -229,7 +232,8 @@ public class DeployerTileEntity extends KineticTileEntity {
|
|||
}
|
||||
|
||||
public boolean startBoop(Direction facing) {
|
||||
if (!level.isEmptyBlock(worldPosition.relative(facing, 1)) || !level.isEmptyBlock(worldPosition.relative(facing, 2)))
|
||||
if (!level.isEmptyBlock(worldPosition.relative(facing, 1))
|
||||
|| !level.isEmptyBlock(worldPosition.relative(facing, 2)))
|
||||
return false;
|
||||
BlockPos otherDeployer = worldPosition.relative(facing, 4);
|
||||
if (!level.isLoaded(otherDeployer))
|
||||
|
@ -270,8 +274,7 @@ public class DeployerTileEntity extends KineticTileEntity {
|
|||
deployerTile.sendData();
|
||||
|
||||
// award nearby players
|
||||
List<ServerPlayer> players =
|
||||
level.getEntitiesOfClass(ServerPlayer.class, new AABB(worldPosition).inflate(9));
|
||||
List<ServerPlayer> players = level.getEntitiesOfClass(ServerPlayer.class, new AABB(worldPosition).inflate(9));
|
||||
players.forEach(AllTriggers.DEPLOYER_BOOP::trigger);
|
||||
}
|
||||
|
||||
|
@ -280,8 +283,8 @@ public class DeployerTileEntity extends KineticTileEntity {
|
|||
Direction direction = getBlockState().getValue(FACING);
|
||||
Vec3 center = VecHelper.getCenterOf(worldPosition);
|
||||
BlockPos clickedPos = worldPosition.relative(direction, 2);
|
||||
player.yRot = direction.toYRot();
|
||||
player.xRot = direction == Direction.UP ? -90 : direction == Direction.DOWN ? 90 : 0;
|
||||
player.setXRot(direction == Direction.UP ? -90 : direction == Direction.DOWN ? 90 : 0);
|
||||
player.setYRot(direction.toYRot());
|
||||
|
||||
if (direction == Direction.DOWN
|
||||
&& TileEntityBehaviour.get(level, clickedPos, TransportedItemStackHandlerBehaviour.TYPE) != null)
|
||||
|
@ -300,7 +303,7 @@ public class DeployerTileEntity extends KineticTileEntity {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void fromTag(BlockState blockState, CompoundTag compound, boolean clientPacket) {
|
||||
protected void fromTag(CompoundTag compound, boolean clientPacket) {
|
||||
state = NBTHelper.readEnum(compound, "State", State.class);
|
||||
mode = NBTHelper.readEnum(compound, "Mode", Mode.class);
|
||||
timer = compound.getInt("Timer");
|
||||
|
@ -310,7 +313,7 @@ public class DeployerTileEntity extends KineticTileEntity {
|
|||
overflowItems = NBTHelper.readItemList(compound.getList("Overflow", NBT.TAG_COMPOUND));
|
||||
if (compound.contains("HeldItem"))
|
||||
heldItem = ItemStack.of(compound.getCompound("HeldItem"));
|
||||
super.fromTag(blockState, compound, clientPacket);
|
||||
super.fromTag(compound, clientPacket);
|
||||
|
||||
if (!clientPacket)
|
||||
return;
|
||||
|
@ -331,9 +334,11 @@ public class DeployerTileEntity extends KineticTileEntity {
|
|||
|
||||
if (player != null) {
|
||||
ListTag invNBT = new ListTag();
|
||||
player.inventory.save(invNBT);
|
||||
player.getInventory()
|
||||
.save(invNBT);
|
||||
compound.put("Inventory", invNBT);
|
||||
compound.put("HeldItem", player.getMainHandItem().serializeNBT());
|
||||
compound.put("HeldItem", player.getMainHandItem()
|
||||
.serializeNBT());
|
||||
compound.put("Overflow", NBTHelper.writeItemList(overflowItems));
|
||||
} else if (deferredInventoryList != null) {
|
||||
compound.put("Inventory", deferredInventoryList);
|
||||
|
@ -464,7 +469,7 @@ public class DeployerTileEntity extends KineticTileEntity {
|
|||
|
||||
// creates deployer recipes
|
||||
event.addRecipe(() -> SequencedAssemblyRecipe.getRecipe(level, event.getInventory(),
|
||||
AllRecipeTypes.DEPLOYING.getType(), DeployerApplicationRecipe.class), 100);
|
||||
AllRecipeTypes.DEPLOYING.getType(), DeployerApplicationRecipe.class), 100);
|
||||
event.addRecipe(() -> AllRecipeTypes.DEPLOYING.find(event.getInventory(), level), 50);
|
||||
|
||||
// post the event, get result
|
||||
|
|
|
@ -391,7 +391,7 @@ public class AirCurrent {
|
|||
public static boolean isPlayerCreativeFlying(Entity entity) {
|
||||
if (entity instanceof Player) {
|
||||
Player player = (Player) entity;
|
||||
return player.isCreative() && player.abilities.flying;
|
||||
return player.isCreative() && player.getAbilities().flying;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ import com.simibubi.create.content.contraptions.processing.burner.BlazeBurnerBlo
|
|||
import com.simibubi.create.content.logistics.block.chute.ChuteTileEntity;
|
||||
import com.simibubi.create.foundation.config.AllConfigs;
|
||||
|
||||
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
|
@ -28,8 +29,8 @@ public class EncasedFanTileEntity extends GeneratingKineticTileEntity implements
|
|||
protected boolean updateAirFlow;
|
||||
protected boolean updateGenerator;
|
||||
|
||||
public EncasedFanTileEntity(BlockEntityType<? extends EncasedFanTileEntity> type) {
|
||||
super(type);
|
||||
public EncasedFanTileEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
|
||||
super(type, pos, state);
|
||||
isGenerator = false;
|
||||
airCurrent = new AirCurrent(this);
|
||||
updateAirFlow = true;
|
||||
|
@ -37,9 +38,9 @@ public class EncasedFanTileEntity extends GeneratingKineticTileEntity implements
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void fromTag(BlockState state, CompoundTag compound, boolean clientPacket) {
|
||||
super.fromTag(state, compound, clientPacket);
|
||||
if (!wasMoved)
|
||||
protected void fromTag(CompoundTag compound, boolean clientPacket) {
|
||||
super.fromTag(compound, clientPacket);
|
||||
if (!wasMoved)
|
||||
isGenerator = compound.getBoolean("Generating");
|
||||
if (clientPacket)
|
||||
airCurrent.rebuild();
|
||||
|
@ -81,7 +82,8 @@ public class EncasedFanTileEntity extends GeneratingKineticTileEntity implements
|
|||
shouldGenerate = false;
|
||||
|
||||
if (shouldGenerate)
|
||||
shouldGenerate = level != null && level.hasNeighborSignal(worldPosition) && level.isLoaded(worldPosition.below()) && blockBelowIsHot();
|
||||
shouldGenerate = level != null && level.hasNeighborSignal(worldPosition)
|
||||
&& level.isLoaded(worldPosition.below()) && blockBelowIsHot();
|
||||
|
||||
if (shouldGenerate == isGenerator)
|
||||
return;
|
||||
|
@ -94,8 +96,7 @@ public class EncasedFanTileEntity extends GeneratingKineticTileEntity implements
|
|||
return false;
|
||||
BlockState checkState = level.getBlockState(worldPosition.below());
|
||||
|
||||
if (!checkState.getBlock()
|
||||
.is(AllBlockTags.FAN_HEATERS.tag))
|
||||
if (!checkState.is(AllBlockTags.FAN_HEATERS.tag))
|
||||
return false;
|
||||
|
||||
if (checkState.hasProperty(BlazeBurnerBlock.HEAT_LEVEL) && !checkState.getValue(BlazeBurnerBlock.HEAT_LEVEL)
|
||||
|
@ -176,7 +177,7 @@ public class EncasedFanTileEntity extends GeneratingKineticTileEntity implements
|
|||
super.tick();
|
||||
|
||||
boolean server = !level.isClientSide || isVirtual();
|
||||
|
||||
|
||||
if (server && airCurrentUpdateCooldown-- <= 0) {
|
||||
airCurrentUpdateCooldown = AllConfigs.SERVER.kinetics.fanBlockCheckRate.get();
|
||||
updateAirFlow = true;
|
||||
|
@ -187,7 +188,7 @@ public class EncasedFanTileEntity extends GeneratingKineticTileEntity implements
|
|||
airCurrent.rebuild();
|
||||
sendData();
|
||||
}
|
||||
|
||||
|
||||
if (updateGenerator) {
|
||||
updateGenerator = false;
|
||||
updateGenerator();
|
||||
|
|
|
@ -5,6 +5,7 @@ import javax.annotation.Nullable;
|
|||
import com.simibubi.create.foundation.config.AllConfigs;
|
||||
import com.simibubi.create.foundation.config.CKinetics;
|
||||
|
||||
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.util.Mth;
|
||||
|
|
|
@ -6,6 +6,7 @@ import com.simibubi.create.AllShapes;
|
|||
import com.simibubi.create.AllTileEntities;
|
||||
import com.simibubi.create.foundation.block.WrenchableDirectionalBlock;
|
||||
|
||||
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
|
|
|
@ -33,8 +33,8 @@ public class NozzleTileEntity extends SmartTileEntity {
|
|||
private boolean pushing;
|
||||
private BlockPos fanPos;
|
||||
|
||||
public NozzleTileEntity(BlockEntityType<? extends NozzleTileEntity> type) {
|
||||
super(type);
|
||||
public NozzleTileEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
|
||||
super(type, pos, state);
|
||||
setLazyTickRate(5);
|
||||
}
|
||||
|
||||
|
@ -51,8 +51,8 @@ public class NozzleTileEntity extends SmartTileEntity {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void fromTag(BlockState state, CompoundTag compound, boolean clientPacket) {
|
||||
super.fromTag(state, compound, clientPacket);
|
||||
protected void fromTag(CompoundTag compound, boolean clientPacket) {
|
||||
super.fromTag(compound, clientPacket);
|
||||
if (!clientPacket)
|
||||
return;
|
||||
range = compound.getFloat("Range");
|
||||
|
@ -176,7 +176,7 @@ public class NozzleTileEntity extends SmartTileEntity {
|
|||
level.explode(null, center.x, center.y, center.z, 2, BlockInteraction.NONE);
|
||||
for (Iterator<Entity> iterator = pushingEntities.iterator(); iterator.hasNext();) {
|
||||
Entity entity = iterator.next();
|
||||
entity.remove();
|
||||
entity.discard();
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.simibubi.create.content.contraptions.components.flywheel;
|
||||
|
||||
import static net.minecraft.state.properties.BlockStateProperties.HORIZONTAL_FACING;
|
||||
import static net.minecraft.world.level.block.state.properties.BlockStateProperties.HORIZONTAL_FACING;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
@ -13,7 +13,7 @@ import com.jozufozu.flywheel.backend.material.Material;
|
|||
import com.jozufozu.flywheel.backend.material.MaterialManager;
|
||||
import com.jozufozu.flywheel.core.materials.model.ModelData;
|
||||
import com.jozufozu.flywheel.util.transform.MatrixTransformStack;
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.simibubi.create.AllBlockPartials;
|
||||
import com.simibubi.create.content.contraptions.base.KineticTileInstance;
|
||||
import com.simibubi.create.content.contraptions.base.RotatingData;
|
||||
|
@ -21,31 +21,31 @@ import com.simibubi.create.foundation.utility.AngleHelper;
|
|||
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
||||
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.level.block.Rotation;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
||||
public class FlyWheelInstance extends KineticTileInstance<FlywheelTileEntity> implements IDynamicInstance {
|
||||
|
||||
protected final Direction facing;
|
||||
protected final Direction connection;
|
||||
protected final Direction facing;
|
||||
protected final Direction connection;
|
||||
|
||||
protected boolean connectedLeft;
|
||||
protected float connectorAngleMult;
|
||||
protected boolean connectedLeft;
|
||||
protected float connectorAngleMult;
|
||||
|
||||
protected final RotatingData shaft;
|
||||
protected final RotatingData shaft;
|
||||
|
||||
protected final ModelData wheel;
|
||||
protected final ModelData wheel;
|
||||
|
||||
protected List<ModelData> connectors;
|
||||
protected ModelData upperRotating;
|
||||
protected ModelData lowerRotating;
|
||||
protected ModelData upperSliding;
|
||||
protected ModelData lowerSliding;
|
||||
protected List<ModelData> connectors;
|
||||
protected ModelData upperRotating;
|
||||
protected ModelData lowerRotating;
|
||||
protected ModelData upperSliding;
|
||||
protected ModelData lowerSliding;
|
||||
|
||||
protected float lastAngle = Float.NaN;
|
||||
protected float lastAngle = Float.NaN;
|
||||
|
||||
public FlyWheelInstance(MaterialManager modelManager, FlywheelTileEntity tile) {
|
||||
public FlyWheelInstance(MaterialManager modelManager, FlywheelTileEntity tile) {
|
||||
super(modelManager, tile);
|
||||
|
||||
facing = blockState.getValue(HORIZONTAL_FACING);
|
||||
|
@ -53,145 +53,154 @@ public class FlyWheelInstance extends KineticTileInstance<FlywheelTileEntity> im
|
|||
shaft = setup(shaftModel().createInstance());
|
||||
|
||||
BlockState referenceState = blockState.rotate(Rotation.CLOCKWISE_90);
|
||||
wheel = getTransformMaterial().getModel(AllBlockPartials.FLYWHEEL, referenceState, referenceState.getValue(HORIZONTAL_FACING)).createInstance();
|
||||
wheel = getTransformMaterial()
|
||||
.getModel(AllBlockPartials.FLYWHEEL, referenceState, referenceState.getValue(HORIZONTAL_FACING))
|
||||
.createInstance();
|
||||
|
||||
connection = FlywheelBlock.getConnection(blockState);
|
||||
if (connection != null) {
|
||||
connectedLeft = blockState.getValue(FlywheelBlock.CONNECTION) == FlywheelBlock.ConnectionState.LEFT;
|
||||
|
||||
boolean flipAngle = connection.getAxis() == Direction.Axis.X ^ connection.getAxisDirection() == Direction.AxisDirection.NEGATIVE;
|
||||
boolean flipAngle = connection.getAxis() == Direction.Axis.X
|
||||
^ connection.getAxisDirection() == Direction.AxisDirection.NEGATIVE;
|
||||
|
||||
connectorAngleMult = flipAngle ? -1 : 1;
|
||||
|
||||
Material<ModelData> mat = getTransformMaterial();
|
||||
|
||||
upperRotating = mat.getModel(AllBlockPartials.FLYWHEEL_UPPER_ROTATING, blockState).createInstance();
|
||||
lowerRotating = mat.getModel(AllBlockPartials.FLYWHEEL_LOWER_ROTATING, blockState).createInstance();
|
||||
upperSliding = mat.getModel(AllBlockPartials.FLYWHEEL_UPPER_SLIDING, blockState).createInstance();
|
||||
lowerSliding = mat.getModel(AllBlockPartials.FLYWHEEL_LOWER_SLIDING, blockState).createInstance();
|
||||
upperRotating = mat.getModel(AllBlockPartials.FLYWHEEL_UPPER_ROTATING, blockState)
|
||||
.createInstance();
|
||||
lowerRotating = mat.getModel(AllBlockPartials.FLYWHEEL_LOWER_ROTATING, blockState)
|
||||
.createInstance();
|
||||
upperSliding = mat.getModel(AllBlockPartials.FLYWHEEL_UPPER_SLIDING, blockState)
|
||||
.createInstance();
|
||||
lowerSliding = mat.getModel(AllBlockPartials.FLYWHEEL_LOWER_SLIDING, blockState)
|
||||
.createInstance();
|
||||
|
||||
connectors = Lists.newArrayList(upperRotating, lowerRotating, upperSliding, lowerSliding);
|
||||
} else {
|
||||
connectors = Collections.emptyList();
|
||||
}
|
||||
connectors = Collections.emptyList();
|
||||
}
|
||||
|
||||
animate(tile.angle);
|
||||
}
|
||||
animate(tile.angle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beginFrame() {
|
||||
@Override
|
||||
public void beginFrame() {
|
||||
|
||||
float partialTicks = AnimationTickHolder.getPartialTicks();
|
||||
float partialTicks = AnimationTickHolder.getPartialTicks();
|
||||
|
||||
float speed = tile.visualSpeed.get(partialTicks) * 3 / 10f;
|
||||
float angle = tile.angle + speed * partialTicks;
|
||||
float speed = tile.visualSpeed.get(partialTicks) * 3 / 10f;
|
||||
float angle = tile.angle + speed * partialTicks;
|
||||
|
||||
if (Math.abs(angle - lastAngle) < 0.001) return;
|
||||
if (Math.abs(angle - lastAngle) < 0.001)
|
||||
return;
|
||||
|
||||
animate(angle);
|
||||
animate(angle);
|
||||
|
||||
lastAngle = angle;
|
||||
}
|
||||
lastAngle = angle;
|
||||
}
|
||||
|
||||
private void animate(float angle) {
|
||||
MatrixStack ms = new MatrixStack();
|
||||
MatrixTransformStack msr = MatrixTransformStack.of(ms);
|
||||
private void animate(float angle) {
|
||||
PoseStack ms = new PoseStack();
|
||||
MatrixTransformStack msr = MatrixTransformStack.of(ms);
|
||||
|
||||
msr.translate(getInstancePosition());
|
||||
msr.translate(getInstancePosition());
|
||||
|
||||
if (connection != null) {
|
||||
float rotation = angle * connectorAngleMult;
|
||||
if (connection != null) {
|
||||
float rotation = angle * connectorAngleMult;
|
||||
|
||||
ms.pushPose();
|
||||
rotateToFacing(msr, connection);
|
||||
ms.pushPose();
|
||||
rotateToFacing(msr, connection);
|
||||
|
||||
ms.pushPose();
|
||||
transformConnector(msr, true, true, rotation, connectedLeft);
|
||||
upperRotating.setTransform(ms);
|
||||
ms.popPose();
|
||||
ms.pushPose();
|
||||
transformConnector(msr, true, true, rotation, connectedLeft);
|
||||
upperRotating.setTransform(ms);
|
||||
ms.popPose();
|
||||
|
||||
ms.pushPose();
|
||||
transformConnector(msr, false, true, rotation, connectedLeft);
|
||||
lowerRotating.setTransform(ms);
|
||||
ms.popPose();
|
||||
ms.pushPose();
|
||||
transformConnector(msr, false, true, rotation, connectedLeft);
|
||||
lowerRotating.setTransform(ms);
|
||||
ms.popPose();
|
||||
|
||||
ms.pushPose();
|
||||
transformConnector(msr, true, false, rotation, connectedLeft);
|
||||
upperSliding.setTransform(ms);
|
||||
ms.popPose();
|
||||
ms.pushPose();
|
||||
transformConnector(msr, true, false, rotation, connectedLeft);
|
||||
upperSliding.setTransform(ms);
|
||||
ms.popPose();
|
||||
|
||||
ms.pushPose();
|
||||
transformConnector(msr, false, false, rotation, connectedLeft);
|
||||
lowerSliding.setTransform(ms);
|
||||
ms.popPose();
|
||||
ms.pushPose();
|
||||
transformConnector(msr, false, false, rotation, connectedLeft);
|
||||
lowerSliding.setTransform(ms);
|
||||
ms.popPose();
|
||||
|
||||
ms.popPose();
|
||||
}
|
||||
ms.popPose();
|
||||
}
|
||||
|
||||
msr.centre()
|
||||
.rotate(Direction.get(Direction.AxisDirection.POSITIVE, facing.getAxis()), AngleHelper.rad(angle))
|
||||
.unCentre();
|
||||
msr.centre()
|
||||
.rotate(Direction.get(Direction.AxisDirection.POSITIVE, facing.getAxis()), AngleHelper.rad(angle))
|
||||
.unCentre();
|
||||
|
||||
wheel.setTransform(ms);
|
||||
}
|
||||
wheel.setTransform(ms);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
updateRotation(shaft);
|
||||
}
|
||||
@Override
|
||||
public void update() {
|
||||
updateRotation(shaft);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateLight() {
|
||||
relight(pos, shaft, wheel);
|
||||
@Override
|
||||
public void updateLight() {
|
||||
relight(pos, shaft, wheel);
|
||||
|
||||
if (connection != null) {
|
||||
relight(this.pos.relative(connection), connectors.stream());
|
||||
}
|
||||
}
|
||||
if (connection != null) {
|
||||
relight(this.pos.relative(connection), connectors.stream());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
shaft.delete();
|
||||
wheel.delete();
|
||||
@Override
|
||||
public void remove() {
|
||||
shaft.delete();
|
||||
wheel.delete();
|
||||
|
||||
connectors.forEach(InstanceData::delete);
|
||||
connectors.clear();
|
||||
}
|
||||
connectors.forEach(InstanceData::delete);
|
||||
connectors.clear();
|
||||
}
|
||||
|
||||
protected Instancer<RotatingData> shaftModel() {
|
||||
protected Instancer<RotatingData> shaftModel() {
|
||||
Direction opposite = facing.getOpposite();
|
||||
return getRotatingMaterial().getModel(AllBlockPartials.SHAFT_HALF, blockState, opposite);
|
||||
}
|
||||
|
||||
protected void transformConnector(MatrixTransformStack ms, boolean upper, boolean rotating, float angle, boolean flip) {
|
||||
float shift = upper ? 1 / 4f : -1 / 8f;
|
||||
float offset = upper ? 1 / 4f : 1 / 4f;
|
||||
float radians = (float) (angle / 180 * Math.PI);
|
||||
float shifting = MathHelper.sin(radians) * shift + offset;
|
||||
protected void transformConnector(MatrixTransformStack ms, boolean upper, boolean rotating, float angle,
|
||||
boolean flip) {
|
||||
float shift = upper ? 1 / 4f : -1 / 8f;
|
||||
float offset = upper ? 1 / 4f : 1 / 4f;
|
||||
float radians = (float) (angle / 180 * Math.PI);
|
||||
float shifting = Mth.sin(radians) * shift + offset;
|
||||
|
||||
float maxAngle = upper ? -5 : -15;
|
||||
float minAngle = upper ? -45 : 5;
|
||||
float barAngle = 0;
|
||||
float maxAngle = upper ? -5 : -15;
|
||||
float minAngle = upper ? -45 : 5;
|
||||
float barAngle = 0;
|
||||
|
||||
if (rotating)
|
||||
barAngle = MathHelper.lerp((MathHelper.sin((float) (radians + Math.PI / 2)) + 1) / 2, minAngle, maxAngle);
|
||||
if (rotating)
|
||||
barAngle = Mth.lerp((Mth.sin((float) (radians + Math.PI / 2)) + 1) / 2, minAngle, maxAngle);
|
||||
|
||||
float pivotX = (upper ? 8f : 3f) / 16;
|
||||
float pivotY = (upper ? 8f : 2f) / 16;
|
||||
float pivotZ = (upper ? 23f : 21.5f) / 16f;
|
||||
float pivotX = (upper ? 8f : 3f) / 16;
|
||||
float pivotY = (upper ? 8f : 2f) / 16;
|
||||
float pivotZ = (upper ? 23f : 21.5f) / 16f;
|
||||
|
||||
ms.translate(pivotX, pivotY, pivotZ + shifting);
|
||||
if (rotating)
|
||||
ms.rotate(Direction.EAST, AngleHelper.rad(barAngle));
|
||||
ms.translate(-pivotX, -pivotY, -pivotZ);
|
||||
ms.translate(pivotX, pivotY, pivotZ + shifting);
|
||||
if (rotating)
|
||||
ms.rotate(Direction.EAST, AngleHelper.rad(barAngle));
|
||||
ms.translate(-pivotX, -pivotY, -pivotZ);
|
||||
|
||||
if (flip && !upper)
|
||||
ms.translate(9 / 16f, 0, 0);
|
||||
}
|
||||
if (flip && !upper)
|
||||
ms.translate(9 / 16f, 0, 0);
|
||||
}
|
||||
|
||||
protected void rotateToFacing(MatrixTransformStack buffer, Direction facing) {
|
||||
buffer.centre()
|
||||
.rotate(Direction.UP, AngleHelper.rad(AngleHelper.horizontalAngle(facing)))
|
||||
.unCentre();
|
||||
}
|
||||
protected void rotateToFacing(MatrixTransformStack buffer, Direction facing) {
|
||||
buffer.centre()
|
||||
.rotate(Direction.UP, AngleHelper.rad(AngleHelper.horizontalAngle(facing)))
|
||||
.unCentre();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.simibubi.create.content.contraptions.components.flywheel;
|
|||
import com.simibubi.create.content.contraptions.base.GeneratingKineticTileEntity;
|
||||
import com.simibubi.create.foundation.gui.widgets.InterpolatedChasingValue;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
@ -18,8 +19,8 @@ public class FlywheelTileEntity extends GeneratingKineticTileEntity {
|
|||
InterpolatedChasingValue visualSpeed = new InterpolatedChasingValue();
|
||||
float angle;
|
||||
|
||||
public FlywheelTileEntity(BlockEntityType<? extends FlywheelTileEntity> type) {
|
||||
super(type);
|
||||
public FlywheelTileEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
|
||||
super(type, pos, state);
|
||||
}
|
||||
|
||||
public void setRotation(float speed, float capacity) {
|
||||
|
@ -62,11 +63,11 @@ public class FlywheelTileEntity extends GeneratingKineticTileEntity {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void fromTag(BlockState state, CompoundTag compound, boolean clientPacket) {
|
||||
protected void fromTag(CompoundTag compound, boolean clientPacket) {
|
||||
generatedSpeed = compound.getFloat("GeneratedSpeed");
|
||||
generatedCapacity = compound.getFloat("GeneratedCapacity");
|
||||
stoppingCooldown = compound.getInt("Cooldown");
|
||||
super.fromTag(state, compound, clientPacket);
|
||||
super.fromTag(compound, clientPacket);
|
||||
if (clientPacket)
|
||||
visualSpeed.withSpeed(1 / 32f)
|
||||
.target(getGeneratedSpeed());
|
||||
|
|
|
@ -24,8 +24,8 @@ public class EngineTileEntity extends SmartTileEntity implements IInstanceRender
|
|||
public float appliedSpeed;
|
||||
protected FlywheelTileEntity poweredWheel;
|
||||
|
||||
public EngineTileEntity(BlockEntityType<?> tileEntityTypeIn) {
|
||||
super(tileEntityTypeIn);
|
||||
public EngineTileEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
|
||||
super(type, pos, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -3,14 +3,15 @@ package com.simibubi.create.content.contraptions.components.flywheel.engine;
|
|||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.foundation.block.BlockStressValues;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.block.AbstractFurnaceBlock;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
||||
public class FurnaceEngineTileEntity extends EngineTileEntity {
|
||||
|
||||
public FurnaceEngineTileEntity(BlockEntityType<? extends FurnaceEngineTileEntity> type) {
|
||||
super(type);
|
||||
public FurnaceEngineTileEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
|
||||
super(type, pos, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -68,14 +68,14 @@ public class MillstoneBlock extends KineticBlock implements ITE<MillstoneTileEnt
|
|||
ItemStack stackInSlot = inv.getStackInSlot(slot);
|
||||
if (!stackInSlot.isEmpty())
|
||||
emptyOutput = false;
|
||||
player.inventory.placeItemBackInInventory(worldIn, stackInSlot);
|
||||
player.getInventory().placeItemBackInInventory(worldIn, stackInSlot);
|
||||
inv.setStackInSlot(slot, ItemStack.EMPTY);
|
||||
}
|
||||
|
||||
if (emptyOutput) {
|
||||
inv = millstone.inputInv;
|
||||
for (int slot = 0; slot < inv.getSlots(); slot++) {
|
||||
player.inventory.placeItemBackInInventory(worldIn, inv.getStackInSlot(slot));
|
||||
player.getInventory().placeItemBackInInventory(worldIn, inv.getStackInSlot(slot));
|
||||
inv.setStackInSlot(slot, ItemStack.EMPTY);
|
||||
}
|
||||
}
|
||||
|
@ -113,7 +113,7 @@ public class MillstoneBlock extends KineticBlock implements ITE<MillstoneTileEnt
|
|||
|
||||
ItemStack remainder = capability.orElse(new ItemStackHandler()).insertItem(0, itemEntity.getItem(), false);
|
||||
if (remainder.isEmpty())
|
||||
itemEntity.remove();
|
||||
itemEntity.discard();
|
||||
if (remainder.getCount() < itemEntity.getItem().getCount())
|
||||
itemEntity.setItem(remainder);
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
|
|||
import com.simibubi.create.foundation.tileEntity.behaviour.belt.DirectBeltInputBehaviour;
|
||||
import com.simibubi.create.foundation.utility.VecHelper;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.Direction.Axis;
|
||||
import net.minecraft.core.particles.ItemParticleOption;
|
||||
|
@ -39,8 +40,8 @@ public class MillstoneTileEntity extends KineticTileEntity {
|
|||
public int timer;
|
||||
private MillingRecipe lastRecipe;
|
||||
|
||||
public MillstoneTileEntity(BlockEntityType<? extends MillstoneTileEntity> type) {
|
||||
super(type);
|
||||
public MillstoneTileEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
|
||||
super(type, pos, state);
|
||||
inputInv = new ItemStackHandler(1);
|
||||
outputInv = new ItemStackHandler(9);
|
||||
capability = LazyOptional.of(MillstoneInventoryHandler::new);
|
||||
|
@ -162,11 +163,11 @@ public class MillstoneTileEntity extends KineticTileEntity {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void fromTag(BlockState state, CompoundTag compound, boolean clientPacket) {
|
||||
protected void fromTag(CompoundTag compound, boolean clientPacket) {
|
||||
timer = compound.getInt("Timer");
|
||||
inputInv.deserializeNBT(compound.getCompound("InputInventory"));
|
||||
outputInv.deserializeNBT(compound.getCompound("OutputInventory"));
|
||||
super.fromTag(state, compound, clientPacket);
|
||||
super.fromTag(compound, clientPacket);
|
||||
}
|
||||
|
||||
public int getProcessingSpeed() {
|
||||
|
|
|
@ -20,6 +20,7 @@ import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
|||
import com.simibubi.create.foundation.utility.Couple;
|
||||
import com.simibubi.create.foundation.utility.VecHelper;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction.Axis;
|
||||
import net.minecraft.core.particles.ItemParticleOption;
|
||||
import net.minecraft.core.particles.ParticleOptions;
|
||||
|
@ -49,8 +50,8 @@ public class MechanicalMixerTileEntity extends BasinOperatingTileEntity {
|
|||
public int processingTicks;
|
||||
public boolean running;
|
||||
|
||||
public MechanicalMixerTileEntity(BlockEntityType<? extends MechanicalMixerTileEntity> type) {
|
||||
super(type);
|
||||
public MechanicalMixerTileEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
|
||||
super(type, pos, state);
|
||||
}
|
||||
|
||||
public float getRenderedHeadOffset(float partialTicks) {
|
||||
|
@ -94,10 +95,10 @@ public class MechanicalMixerTileEntity extends BasinOperatingTileEntity {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void fromTag(BlockState state, CompoundTag compound, boolean clientPacket) {
|
||||
protected void fromTag(CompoundTag compound, boolean clientPacket) {
|
||||
running = compound.getBoolean("Running");
|
||||
runningTicks = compound.getInt("Ticks");
|
||||
super.fromTag(state, compound, clientPacket);
|
||||
super.fromTag(compound, clientPacket);
|
||||
|
||||
if (clientPacket && hasLevel())
|
||||
getBasin().ifPresent(bte -> bte.setAreFluidsMoving(running && runningTicks <= 20));
|
||||
|
|
|
@ -8,6 +8,8 @@ import com.simibubi.create.content.contraptions.base.RotatingData;
|
|||
import com.simibubi.create.content.contraptions.base.ShaftlessCogInstance;
|
||||
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
||||
|
||||
import net.minecraft.core.Direction;
|
||||
|
||||
public class MixerInstance extends ShaftlessCogInstance implements IDynamicInstance {
|
||||
|
||||
private final RotatingData mixerHead;
|
||||
|
|
|
@ -11,15 +11,17 @@ import com.simibubi.create.foundation.tileEntity.behaviour.scrollvalue.ScrollVal
|
|||
import com.simibubi.create.foundation.tileEntity.behaviour.scrollvalue.ScrollValueBehaviour.StepContext;
|
||||
import com.simibubi.create.foundation.utility.Lang;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
||||
public class CreativeMotorTileEntity extends GeneratingKineticTileEntity {
|
||||
|
||||
public static final int DEFAULT_SPEED = 16;
|
||||
protected ScrollValueBehaviour generatedSpeed;
|
||||
|
||||
public CreativeMotorTileEntity(BlockEntityType<? extends CreativeMotorTileEntity> type) {
|
||||
super(type);
|
||||
public CreativeMotorTileEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
|
||||
super(type, pos, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -24,6 +24,7 @@ import com.simibubi.create.foundation.tileEntity.behaviour.belt.TransportedItemS
|
|||
import com.simibubi.create.foundation.utility.NBTHelper;
|
||||
import com.simibubi.create.foundation.utility.VecHelper;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.NonNullList;
|
||||
import net.minecraft.core.particles.ItemParticleOption;
|
||||
import net.minecraft.core.particles.ParticleTypes;
|
||||
|
@ -64,8 +65,8 @@ public class MechanicalPressTileEntity extends BasinOperatingTileEntity {
|
|||
public Mode mode;
|
||||
public boolean finished;
|
||||
|
||||
public MechanicalPressTileEntity(BlockEntityType<? extends MechanicalPressTileEntity> type) {
|
||||
super(type);
|
||||
public MechanicalPressTileEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
|
||||
super(type, pos, state);
|
||||
mode = Mode.WORLD;
|
||||
entityScanCooldown = ENTITY_SCAN;
|
||||
}
|
||||
|
@ -80,12 +81,12 @@ public class MechanicalPressTileEntity extends BasinOperatingTileEntity {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void fromTag(BlockState state, CompoundTag compound, boolean clientPacket) {
|
||||
protected void fromTag(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(state, compound, clientPacket);
|
||||
super.fromTag(compound, clientPacket);
|
||||
|
||||
if (clientPacket) {
|
||||
NBTHelper.iterateCompoundList(compound.getList("ParticleItems", NBT.TAG_COMPOUND),
|
||||
|
|
|
@ -11,6 +11,7 @@ import com.simibubi.create.foundation.item.ItemHelper;
|
|||
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
|
||||
import com.simibubi.create.foundation.tileEntity.behaviour.filtering.FilteringBehaviour;
|
||||
|
||||
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.Direction.Axis;
|
||||
|
|
|
@ -1,40 +1,33 @@
|
|||
package com.simibubi.create.content.contraptions.components.saw;
|
||||
|
||||
import static net.minecraft.state.properties.BlockStateProperties.FACING;
|
||||
|
||||
import com.net.minimport com.jozufozu.flywheel.backend.instancing.Instancer;
|
||||
import com.jozufozu.flywheel.backend.instancing.Instancer;
|
||||
import com.jozufozu.flywheel.backend.material.MaterialManager;
|
||||
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
||||
import com.simibubi.create.content.contraptions.base.RotatingData;
|
||||
import com.simibubi.create.content.contraptions.base.SingleRotatingInstance;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.level.block.Rotation;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
||||
ecraft.world.level.block.state.properties.BlockStatePropertiesport com.jozufozu.flywheel.backend.material.MaterialManager;
|
||||
import com.simibubi.create.AllBlockPartials;
|
||||
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
||||
import com.simibubi.create.content.contraptions.base.RotatingData;
|
||||
import com.simibubi.create.content.contraptions.base.SingleRotatingInstance;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Rotation;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.level.block.Rotation;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
||||
|
||||
public class SawInstance extends SingleRotatingInstance {
|
||||
|
||||
public SawInstance(MaterialManager modelManager, KineticTileEntity tile) {
|
||||
super(modelManager, tile);
|
||||
}
|
||||
public SawInstance(MaterialManager modelManager, KineticTileEntity tile) {
|
||||
super(modelManager, tile);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Instancer<RotatingData> getModel() {
|
||||
if (blockState.getValue(FACING).getAxis().isHorizontal()) {
|
||||
@Override
|
||||
protected Instancer<RotatingData> getModel() {
|
||||
if (blockState.getValue(BlockStateProperties.FACING)
|
||||
.getAxis()
|
||||
.isHorizontal()) {
|
||||
BlockState referenceState = blockState.rotate(tile.getLevel(), tile.getBlockPos(), Rotation.CLOCKWISE_180);
|
||||
Direction facing = referenceState.getValue(FACING);
|
||||
Direction facing = referenceState.getValue(BlockStateProperties.FACING);
|
||||
return getRotatingMaterial().getModel(AllBlockPartials.SHAFT_HALF, referenceState, facing);
|
||||
} else {
|
||||
return getRotatingMaterial().getModel(shaft());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ import com.simibubi.create.foundation.utility.VecHelper;
|
|||
import com.simibubi.create.foundation.utility.recipe.RecipeConditions;
|
||||
import com.simibubi.create.foundation.utility.recipe.RecipeFinder;
|
||||
|
||||
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.Registry;
|
||||
|
@ -84,8 +85,8 @@ public class SawTileEntity extends BlockBreakingKineticTileEntity {
|
|||
|
||||
private ItemStack playEvent;
|
||||
|
||||
public SawTileEntity(BlockEntityType<? extends SawTileEntity> type) {
|
||||
super(type);
|
||||
public SawTileEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
|
||||
super(type, pos, state);
|
||||
inventory = new ProcessingInventory(this::start).withSlotLimit(!AllConfigs.SERVER.recipes.bulkCutting.get());
|
||||
inventory.remainingTime = -1;
|
||||
recipeIndex = 0;
|
||||
|
@ -114,8 +115,8 @@ public class SawTileEntity extends BlockBreakingKineticTileEntity {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void fromTag(BlockState state, CompoundTag compound, boolean clientPacket) {
|
||||
super.fromTag(state, compound, clientPacket);
|
||||
protected void fromTag(CompoundTag compound, boolean clientPacket) {
|
||||
super.fromTag(compound, clientPacket);
|
||||
inventory.deserializeNBT(compound.getCompound("Inventory"));
|
||||
recipeIndex = compound.getInt("RecipeIndex");
|
||||
if (compound.contains("PlayEvent"))
|
||||
|
@ -383,7 +384,7 @@ public class SawTileEntity extends BlockBreakingKineticTileEntity {
|
|||
ItemStack remainder = inventory.insertItem(0, entity.getItem()
|
||||
.copy(), false);
|
||||
if (remainder.isEmpty())
|
||||
entity.remove();
|
||||
entity.discard();
|
||||
else
|
||||
entity.setItem(remainder);
|
||||
}
|
||||
|
@ -444,9 +445,11 @@ public class SawTileEntity extends BlockBreakingKineticTileEntity {
|
|||
|
||||
@Override
|
||||
public void onBlockBroken(BlockState stateToBreak) {
|
||||
Optional<AbstractBlockBreakQueue> dynamicTree = TreeCutter.findDynamicTree(stateToBreak.getBlock(), breakingPos);
|
||||
Optional<AbstractBlockBreakQueue> dynamicTree =
|
||||
TreeCutter.findDynamicTree(stateToBreak.getBlock(), breakingPos);
|
||||
if (dynamicTree.isPresent()) {
|
||||
dynamicTree.get().destroyBlocks(level, null, this::dropItemFromCutTree);
|
||||
dynamicTree.get()
|
||||
.destroyBlocks(level, null, this::dropItemFromCutTree);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -51,6 +51,7 @@ import net.minecraft.world.phys.AABB;
|
|||
import net.minecraft.world.phys.Vec3;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.fml.util.ObfuscationReflectionHelper;
|
||||
import net.minecraftforge.fmllegacy.common.registry.IEntityAdditionalSpawnData;
|
||||
import net.minecraftforge.fmllegacy.network.NetworkHooks;
|
||||
import net.minecraftforge.fmllegacy.network.PacketDistributor;
|
||||
|
@ -58,7 +59,7 @@ import net.minecraftforge.fmllegacy.network.PacketDistributor;
|
|||
public abstract class AbstractContraptionEntity extends Entity implements IEntityAdditionalSpawnData {
|
||||
|
||||
private static final EntityDataAccessor<Boolean> STALLED =
|
||||
SynchedEntityData.defineId(AbstractContraptionEntity.class, EntityDataSerializers.BOOLEAN);
|
||||
SynchedEntityData.defineId(AbstractContraptionEntity.class, EntityDataSerializers.BOOLEAN);
|
||||
|
||||
public final Map<Entity, MutableInt> collidingEntities;
|
||||
|
||||
|
@ -146,7 +147,8 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit
|
|||
if (seat == null)
|
||||
return null;
|
||||
Vec3 transformedVector = toGlobalVector(Vec3.atLowerCornerOf(seat)
|
||||
.add(.5, passenger.getMyRidingOffset() + ySize - .15f, .5), partialTicks).add(VecHelper.getCenterOf(BlockPos.ZERO))
|
||||
.add(.5, passenger.getMyRidingOffset() + ySize - .15f, .5), partialTicks)
|
||||
.add(VecHelper.getCenterOf(BlockPos.ZERO))
|
||||
.subtract(0.5, ySize, 0.5);
|
||||
return transformedVector;
|
||||
}
|
||||
|
@ -165,8 +167,8 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit
|
|||
int indexOfSeat = contraption.getSeats()
|
||||
.indexOf(localPos);
|
||||
if (indexOfSeat == -1)
|
||||
return contraption.interactors.containsKey(localPos)
|
||||
&& contraption.interactors.get(localPos).handlePlayerInteraction(player, interactionHand, localPos, this);
|
||||
return contraption.interactors.containsKey(localPos) && contraption.interactors.get(localPos)
|
||||
.handlePlayerInteraction(player, interactionHand, localPos, this);
|
||||
|
||||
// Eject potential existing passenger
|
||||
Entity toDismount = null;
|
||||
|
@ -218,7 +220,7 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit
|
|||
@Override
|
||||
public final void tick() {
|
||||
if (contraption == null) {
|
||||
remove();
|
||||
discard();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -394,7 +396,7 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit
|
|||
int estimatedPacketSize = byteArray.length;
|
||||
if (estimatedPacketSize > 2_000_000) {
|
||||
Create.LOGGER.warn("Could not send Contraption Spawn Data (Packet too big): "
|
||||
+ getContraption().getType().id + " @" + position() + " (" + getUUID().toString() + ")");
|
||||
+ getContraption().getType().id + " @" + position() + " (" + getUUID().toString() + ")");
|
||||
buffer.writeNbt(new CompoundTag());
|
||||
return;
|
||||
}
|
||||
|
@ -446,7 +448,7 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit
|
|||
if (contraption == null)
|
||||
return;
|
||||
|
||||
remove();
|
||||
discard();
|
||||
|
||||
StructureTransform transform = makeStructureTransform();
|
||||
AllPackets.channel.send(PacketDistributor.TRACKING_ENTITY.with(() -> this),
|
||||
|
@ -483,16 +485,14 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public void remove(boolean keepData) {
|
||||
if (!level.isClientSide && !removed && contraption != null) {
|
||||
public void remove(RemovalReason p_146834_) {
|
||||
if (!level.isClientSide && !isRemoved() && contraption != null)
|
||||
if (!ticking)
|
||||
contraption.stop(level);
|
||||
}
|
||||
if (contraption != null)
|
||||
contraption.onEntityRemoved(this);
|
||||
super.remove(keepData);
|
||||
super.remove(p_146834_);
|
||||
}
|
||||
|
||||
protected abstract StructureTransform makeStructureTransform();
|
||||
|
@ -514,7 +514,7 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit
|
|||
super.onRemovedFromWorld();
|
||||
if (level != null && level.isClientSide)
|
||||
return;
|
||||
getPassengers().forEach(Entity::remove);
|
||||
getPassengers().forEach(Entity::discard);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -551,14 +551,14 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit
|
|||
protected abstract void handleStallInformation(float x, float y, float z, float angle);
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public CompoundTag saveWithoutId(CompoundTag nbt) {
|
||||
Vec3 vec = position();
|
||||
List<Entity> passengers = getPassengers();
|
||||
|
||||
for (Entity entity : passengers) {
|
||||
// setPos has world accessing side-effects when removed == false
|
||||
entity.removed = true;
|
||||
// setPos has world accessing side-effects when removed == null
|
||||
String srg = "f_146795_";
|
||||
ObfuscationReflectionHelper.setPrivateValue(Entity.class, entity, RemovalReason.UNLOADED_TO_CHUNK, srg);
|
||||
|
||||
// Gather passengers into same chunk when saving
|
||||
Vec3 prevVec = entity.position();
|
||||
|
@ -566,7 +566,7 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit
|
|||
|
||||
// Super requires all passengers to not be removed in order to write them to the
|
||||
// tag
|
||||
entity.removed = false;
|
||||
ObfuscationReflectionHelper.setPrivateValue(Entity.class, entity, null, srg);
|
||||
}
|
||||
|
||||
CompoundTag tag = super.saveWithoutId(nbt);
|
||||
|
@ -639,10 +639,10 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean hasOnePlayerPassenger() {
|
||||
public boolean hasExactlyOnePlayerPassenger() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public abstract void doLocalTransforms(float partialTicks, PoseStack[] matrixStacks);
|
||||
|
||||
|
@ -679,18 +679,17 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit
|
|||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected boolean updateInWaterStateAndDoFluidPushing() {
|
||||
/*
|
||||
* Override this with an empty method to reduce enormous calculation time when contraptions are in water
|
||||
* WARNING: THIS HAS A BUNCH OF SIDE EFFECTS!
|
||||
* - Fluids will not try to change contraption movement direction
|
||||
* - this.inWater and this.isInWater() will return unreliable data
|
||||
* - entities riding a contraption will not cause water splashes (seats are their own entity so this should be fine)
|
||||
* - fall distance is not reset when the contraption is in water
|
||||
* - this.eyesInWater and this.canSwim() will always be false
|
||||
* - swimming state will never be updated
|
||||
* Override this with an empty method to reduce enormous calculation time when
|
||||
* contraptions are in water WARNING: THIS HAS A BUNCH OF SIDE EFFECTS! - Fluids
|
||||
* will not try to change contraption movement direction - this.inWater and
|
||||
* this.isInWater() will return unreliable data - entities riding a contraption
|
||||
* will not cause water splashes (seats are their own entity so this should be
|
||||
* fine) - fall distance is not reset when the contraption is in water -
|
||||
* this.eyesInWater and this.canSwim() will always be false - swimming state
|
||||
* will never be updated
|
||||
*/
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -79,8 +79,6 @@ import net.minecraft.nbt.NbtUtils;
|
|||
import net.minecraft.nbt.Tag;
|
||||
import net.minecraft.network.protocol.game.DebugPackets;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.util.math.shapes.IBooleanFunction;
|
||||
import net.minecraft.util.math.shapes.VoxelShapes;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.ai.village.poi.PoiType;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
|
@ -105,10 +103,11 @@ import net.minecraft.world.level.material.Fluids;
|
|||
import net.minecraft.world.level.material.PushReaction;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import net.minecraft.world.phys.shapes.BooleanOp;
|
||||
import net.minecraft.world.phys.shapes.Shapes;
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.client.model.pipeline.BlockInfo;
|
||||
import net.minecraftforge.common.util.Constants.BlockFlags;
|
||||
import net.minecraftforge.common.util.Constants.NBT;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
@ -625,9 +624,9 @@ public abstract class Contraption {
|
|||
protected void addBlock(BlockPos pos, Pair<StructureBlockInfo, BlockEntity> pair) {
|
||||
StructureBlockInfo captured = pair.getKey();
|
||||
BlockPos localPos = pos.subtract(anchor);
|
||||
StructureBlockInfo blockInfo = new StructureBlockInfo(localPos, captured.state, captured.nbt);
|
||||
StructureBlockInfo StructureBlockInfo = new StructureBlockInfo(localPos, captured.state, captured.nbt);
|
||||
|
||||
if (blocks.put(localPos, blockInfo) != null)
|
||||
if (blocks.put(localPos, StructureBlockInfo) != null)
|
||||
return;
|
||||
bounds = bounds.minmax(new AABB(localPos));
|
||||
|
||||
|
@ -637,7 +636,7 @@ public abstract class Contraption {
|
|||
if (te != null && MountedFluidStorage.canUseAsStorage(te))
|
||||
fluidStorage.put(localPos, new MountedFluidStorage(te));
|
||||
if (AllMovementBehaviours.contains(captured.state.getBlock()))
|
||||
actors.add(MutablePair.of(blockInfo, null));
|
||||
actors.add(MutablePair.of(StructureBlockInfo, null));
|
||||
if (AllInteractionBehaviours.contains(captured.state.getBlock()))
|
||||
interactors.put(localPos, AllInteractionBehaviours.of(captured.state.getBlock()));
|
||||
if (te instanceof CreativeCrateTileEntity
|
||||
|
@ -903,7 +902,8 @@ public abstract class Contraption {
|
|||
blockList.forEach(e -> {
|
||||
CompoundTag c = (CompoundTag) e;
|
||||
|
||||
StructureBlockInfo info = usePalettedDeserialization ? readBlockInfo(c, finalPalette) : legacyReadBlockInfo(c);
|
||||
StructureBlockInfo info =
|
||||
usePalettedDeserialization ? readStructureBlockInfo(c, finalPalette) : legacyReadStructureBlockInfo(c);
|
||||
|
||||
this.blocks.put(info.pos, info);
|
||||
|
||||
|
@ -918,10 +918,10 @@ public abstract class Contraption {
|
|||
tag.putInt("y", info.pos.getY());
|
||||
tag.putInt("z", info.pos.getZ());
|
||||
|
||||
BlockEntity te = BlockEntity.loadStatic(info.state, tag);
|
||||
BlockEntity te = BlockEntity.loadStatic(info.pos, info.state, tag);
|
||||
if (te == null)
|
||||
return;
|
||||
te.setLevelAndPosition(new ContraptionTileWorld(world, te, info), te.getBlockPos());
|
||||
te.setLevel(world);
|
||||
if (te instanceof KineticTileEntity)
|
||||
((KineticTileEntity) te).setSpeed(0);
|
||||
te.getBlockState();
|
||||
|
@ -939,13 +939,14 @@ public abstract class Contraption {
|
|||
});
|
||||
}
|
||||
|
||||
private static StructureBlockInfo readBlockInfo(CompoundTag blockListEntry, HashMapPalette<BlockState> palette) {
|
||||
private static StructureBlockInfo readStructureBlockInfo(CompoundTag blockListEntry,
|
||||
HashMapPalette<BlockState> palette) {
|
||||
return new StructureBlockInfo(BlockPos.of(blockListEntry.getLong("Pos")),
|
||||
Objects.requireNonNull(palette.valueFor(blockListEntry.getInt("State"))),
|
||||
blockListEntry.contains("Data") ? blockListEntry.getCompound("Data") : null);
|
||||
}
|
||||
|
||||
private static StructureBlockInfo legacyReadBlockInfo(CompoundTag blockListEntry) {
|
||||
private static StructureBlockInfo legacyReadStructureBlockInfo(CompoundTag blockListEntry) {
|
||||
return new StructureBlockInfo(NbtUtils.readBlockPos(blockListEntry.getCompound("Pos")),
|
||||
NbtUtils.readBlockState(blockListEntry.getCompound("Block")),
|
||||
blockListEntry.contains("Data") ? blockListEntry.getCompound("Data") : null);
|
||||
|
@ -956,7 +957,7 @@ public abstract class Contraption {
|
|||
.forEach(MountedStorage::removeStorageFromWorld);
|
||||
fluidStorage.values()
|
||||
.forEach(MountedFluidStorage::removeStorageFromWorld);
|
||||
glueToRemove.forEach(SuperGlueEntity::remove);
|
||||
glueToRemove.forEach(SuperGlueEntity::discard);
|
||||
|
||||
for (boolean brittles : Iterate.trueAndFalse) {
|
||||
for (Iterator<StructureBlockInfo> iterator = blocks.values()
|
||||
|
@ -993,8 +994,10 @@ public abstract class Contraption {
|
|||
int flags = BlockFlags.IS_MOVING | BlockFlags.DEFAULT;
|
||||
world.sendBlockUpdated(add, block.state, Blocks.AIR.defaultBlockState(), flags);
|
||||
|
||||
// when the blockstate is set to air, the block's POI data is removed, but markAndNotifyBlock tries to
|
||||
// remove it again, so to prevent an error from being logged by double-removal we add the POI data back now
|
||||
// when the blockstate is set to air, the block's POI data is removed, but
|
||||
// markAndNotifyBlock tries to
|
||||
// remove it again, so to prevent an error from being logged by double-removal
|
||||
// we add the POI data back now
|
||||
// (code copied from ServerWorld.onBlockStateChange)
|
||||
ServerLevel serverWorld = (ServerLevel) world;
|
||||
PoiType.forState(block.state)
|
||||
|
@ -1041,7 +1044,8 @@ public abstract class Contraption {
|
|||
Block.dropResources(state, world, targetPos, null);
|
||||
continue;
|
||||
}
|
||||
if (state.getBlock() instanceof SimpleWaterloggedBlock && state.hasProperty(BlockStateProperties.WATERLOGGED)) {
|
||||
if (state.getBlock() instanceof SimpleWaterloggedBlock
|
||||
&& state.hasProperty(BlockStateProperties.WATERLOGGED)) {
|
||||
FluidState FluidState = world.getFluidState(targetPos);
|
||||
state = state.setValue(BlockStateProperties.WATERLOGGED, FluidState.getType() == Fluids.WATER);
|
||||
}
|
||||
|
@ -1073,7 +1077,7 @@ public abstract class Contraption {
|
|||
if (tileEntity instanceof FluidTankTileEntity && tag.contains("LastKnownPos"))
|
||||
tag.put("LastKnownPos", NbtUtils.writeBlockPos(BlockPos.ZERO.below()));
|
||||
|
||||
tileEntity.load(block.state, tag);
|
||||
tileEntity.load(tag);
|
||||
|
||||
if (storage.containsKey(block.pos)) {
|
||||
MountedStorage mountedStorage = storage.get(block.pos);
|
||||
|
@ -1217,11 +1221,11 @@ public abstract class Contraption {
|
|||
return seats;
|
||||
}
|
||||
|
||||
public Map<BlockPos, BlockInfo> getBlocks() {
|
||||
public Map<BlockPos, StructureBlockInfo> getBlocks() {
|
||||
return blocks;
|
||||
}
|
||||
|
||||
public List<MutablePair<BlockInfo, MovementContext>> getActors() {
|
||||
public List<MutablePair<StructureBlockInfo, MovementContext>> getActors() {
|
||||
return actors;
|
||||
}
|
||||
|
||||
|
@ -1248,15 +1252,15 @@ public abstract class Contraption {
|
|||
private void gatherBBsOffThread() {
|
||||
getContraptionWorld();
|
||||
simplifiedEntityColliderProvider = CompletableFuture.supplyAsync(() -> {
|
||||
VoxelShape combinedShape = VoxelShapes.empty();
|
||||
for (Entry<BlockPos, BlockInfo> entry : blocks.entrySet()) {
|
||||
BlockInfo info = entry.getValue();
|
||||
VoxelShape combinedShape = Shapes.empty();
|
||||
for (Entry<BlockPos, StructureBlockInfo> entry : blocks.entrySet()) {
|
||||
StructureBlockInfo info = entry.getValue();
|
||||
BlockPos localPos = entry.getKey();
|
||||
VoxelShape collisionShape = info.state.getCollisionShape(world, localPos);
|
||||
if (collisionShape.isEmpty())
|
||||
continue;
|
||||
combinedShape = VoxelShapes.joinUnoptimized(combinedShape,
|
||||
collisionShape.move(localPos.getX(), localPos.getY(), localPos.getZ()), IBooleanFunction.OR);
|
||||
combinedShape = Shapes.joinUnoptimized(combinedShape,
|
||||
collisionShape.move(localPos.getX(), localPos.getY(), localPos.getZ()), BooleanOp.OR);
|
||||
}
|
||||
return combinedShape.optimize()
|
||||
.toAabbs();
|
||||
|
@ -1297,10 +1301,10 @@ public abstract class Contraption {
|
|||
|
||||
private static class ContraptionTileWorld extends WrappedWorld implements IFlywheelWorld {
|
||||
|
||||
private final TileEntity te;
|
||||
private final BlockInfo info;
|
||||
private final BlockEntity te;
|
||||
private final StructureBlockInfo info;
|
||||
|
||||
public ContraptionTileWorld(World world, TileEntity te, BlockInfo info) {
|
||||
public ContraptionTileWorld(Level world, BlockEntity te, StructureBlockInfo info) {
|
||||
super(world);
|
||||
this.te = te;
|
||||
this.info = info;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.simibubi.create.content.contraptions.components.structureMovement;
|
||||
|
||||
import static net.minecraft.entity.Entity.collideBoundingBoxHeuristically;
|
||||
import static net.minecraft.world.entity.Entity.collideBoundingBoxHeuristically;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
@ -35,6 +35,7 @@ import net.minecraft.sounds.SoundEvents;
|
|||
import net.minecraft.sounds.SoundSource;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.util.RewindableStream;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.item.ItemEntity;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.level.Level;
|
||||
|
@ -240,7 +241,7 @@ public class ContraptionCollider {
|
|||
BlockState blockState = contraption.getBlocks()
|
||||
.get(pos).state;
|
||||
bounce = BlockHelper.getBounceMultiplier(blockState.getBlock());
|
||||
slide = Math.max(0, blockState.getSlipperiness(contraption.world, pos, entity) - .6f);
|
||||
slide = Math.max(0, blockState.getFriction(contraption.world, pos, entity) - .6f);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -298,7 +299,7 @@ public class ContraptionCollider {
|
|||
if (!hardCollision && surfaceCollision.isFalse())
|
||||
continue;
|
||||
|
||||
Vec3 allowedMovement = getAllowedMovement(totalResponse, entity);
|
||||
Vec3 allowedMovement = collide(totalResponse, entity);
|
||||
entity.setPos(entityPosition.x + allowedMovement.x, entityPosition.y + allowedMovement.y,
|
||||
entityPosition.z + allowedMovement.z);
|
||||
entityPosition = entity.position();
|
||||
|
@ -317,7 +318,7 @@ public class ContraptionCollider {
|
|||
entityMotion = entityMotion.multiply(.5f, 1, .5f);
|
||||
}
|
||||
contactPointMotion = contraptionEntity.getContactPointMotion(entityPosition);
|
||||
allowedMovement = getAllowedMovement(contactPointMotion, entity);
|
||||
allowedMovement = collide(contactPointMotion, entity);
|
||||
entity.setPos(entityPosition.x + allowedMovement.x, entityPosition.y,
|
||||
entityPosition.z + allowedMovement.z);
|
||||
}
|
||||
|
@ -329,7 +330,7 @@ public class ContraptionCollider {
|
|||
|
||||
double d0 = entity.getX() - entity.xo - contactPointMotion.x;
|
||||
double d1 = entity.getZ() - entity.zo - contactPointMotion.z;
|
||||
float limbSwing = Mth.sqrt(d0 * d0 + d1 * d1) * 4.0F;
|
||||
float limbSwing = Mth.sqrt((float) (d0 * d0 + d1 * d1)) * 4.0F;
|
||||
if (limbSwing > 1.0F)
|
||||
limbSwing = 1.0F;
|
||||
AllPackets.channel.sendToServer(new ClientMotionPacket(entityMotion, true, limbSwing));
|
||||
|
@ -394,45 +395,45 @@ public class ContraptionCollider {
|
|||
return position;
|
||||
}
|
||||
|
||||
/** From Entity#getAllowedMovement **/
|
||||
static Vec3 getAllowedMovement(Vec3 movement, Entity e) {
|
||||
AABB bb = e.getBoundingBox();
|
||||
CollisionContext ctx = CollisionContext.of(e);
|
||||
Level world = e.level;
|
||||
VoxelShape voxelshape = world.getWorldBorder()
|
||||
/** From Entity#collide **/
|
||||
static Vec3 collide(Vec3 p_20273_, Entity e) {
|
||||
AABB aabb = e.getBoundingBox();
|
||||
CollisionContext collisioncontext = CollisionContext.of(e);
|
||||
VoxelShape voxelshape = e.level.getWorldBorder()
|
||||
.getCollisionShape();
|
||||
Stream<VoxelShape> stream =
|
||||
Shapes.joinIsNotEmpty(voxelshape, Shapes.create(bb.deflate(1.0E-7D)), BooleanOp.AND)
|
||||
? Stream.empty()
|
||||
Shapes.joinIsNotEmpty(voxelshape, Shapes.create(aabb.deflate(1.0E-7D)), BooleanOp.AND) ? Stream.empty()
|
||||
: Stream.of(voxelshape);
|
||||
Stream<VoxelShape> stream1 = world.getEntityCollisions(e, bb.expandTowards(movement), entity -> false); // FIXME: 1.15 equivalent translated correctly?
|
||||
RewindableStream<VoxelShape> reuseablestream = new RewindableStream<>(Stream.concat(stream1, stream));
|
||||
Vec3 allowedMovement = movement.lengthSqr() == 0.0D ? movement
|
||||
: collideBoundingBoxHeuristically(e, movement, bb, world, ctx, reuseablestream);
|
||||
boolean xDifferent = movement.x != allowedMovement.x;
|
||||
boolean yDifferent = movement.y != allowedMovement.y;
|
||||
boolean zDifferent = movement.z != allowedMovement.z;
|
||||
boolean notMovingUp = e.isOnGround() || yDifferent && movement.y < 0.0D;
|
||||
if (e.maxUpStep > 0.0F && notMovingUp && (xDifferent || zDifferent)) {
|
||||
Vec3 allowedStep = collideBoundingBoxHeuristically(e, new Vec3(movement.x, (double) e.maxUpStep, movement.z),
|
||||
bb, world, ctx, reuseablestream);
|
||||
Vec3 allowedStepGivenMovement = collideBoundingBoxHeuristically(e, new Vec3(0.0D, (double) e.maxUpStep, 0.0D),
|
||||
bb.expandTowards(movement.x, 0.0D, movement.z), world, ctx, reuseablestream);
|
||||
if (allowedStepGivenMovement.y < (double) e.maxUpStep) {
|
||||
Vec3 vec3 = collideBoundingBoxHeuristically(e, new Vec3(movement.x, 0.0D, movement.z),
|
||||
bb.move(allowedStepGivenMovement), world, ctx, reuseablestream).add(allowedStepGivenMovement);
|
||||
if (getHorizontalDistanceSqr(vec3) > getHorizontalDistanceSqr(allowedStep)) {
|
||||
allowedStep = vec3;
|
||||
Stream<VoxelShape> stream1 = e.level.getEntityCollisions(e, aabb.expandTowards(p_20273_), (p_19949_) -> {
|
||||
return true;
|
||||
});
|
||||
RewindableStream<VoxelShape> rewindablestream = new RewindableStream<>(Stream.concat(stream1, stream));
|
||||
Vec3 vec3 = p_20273_.lengthSqr() == 0.0D ? p_20273_
|
||||
: collideBoundingBoxHeuristically(e, p_20273_, aabb, e.level, collisioncontext, rewindablestream);
|
||||
boolean flag = p_20273_.x != vec3.x;
|
||||
boolean flag1 = p_20273_.y != vec3.y;
|
||||
boolean flag2 = p_20273_.z != vec3.z;
|
||||
boolean flag3 = e.onGround || flag1 && p_20273_.y < 0.0D;
|
||||
if (e.maxUpStep > 0.0F && flag3 && (flag || flag2)) {
|
||||
Vec3 vec31 = collideBoundingBoxHeuristically(e, new Vec3(p_20273_.x, e.maxUpStep, p_20273_.z), aabb,
|
||||
e.level, collisioncontext, rewindablestream);
|
||||
Vec3 vec32 = collideBoundingBoxHeuristically(e, new Vec3(0.0D, e.maxUpStep, 0.0D),
|
||||
aabb.expandTowards(p_20273_.x, 0.0D, p_20273_.z), e.level, collisioncontext, rewindablestream);
|
||||
if (vec32.y < e.maxUpStep) {
|
||||
Vec3 vec33 = collideBoundingBoxHeuristically(e, new Vec3(p_20273_.x, 0.0D, p_20273_.z),
|
||||
aabb.move(vec32), e.level, collisioncontext, rewindablestream).add(vec32);
|
||||
if (vec33.horizontalDistanceSqr() > vec31.horizontalDistanceSqr()) {
|
||||
vec31 = vec33;
|
||||
}
|
||||
}
|
||||
|
||||
if (getHorizontalDistanceSqr(allowedStep) > getHorizontalDistanceSqr(allowedMovement)) {
|
||||
return allowedStep.add(collideBoundingBoxHeuristically(e, new Vec3(0.0D, -allowedStep.y + movement.y, 0.0D),
|
||||
bb.move(allowedStep), world, ctx, reuseablestream));
|
||||
if (vec31.horizontalDistanceSqr() > vec3.horizontalDistanceSqr()) {
|
||||
return vec31.add(collideBoundingBoxHeuristically(e, new Vec3(0.0D, -vec31.y + p_20273_.y, 0.0D),
|
||||
aabb.move(vec31), e.level, collisioncontext, rewindablestream));
|
||||
}
|
||||
}
|
||||
|
||||
return allowedMovement;
|
||||
return vec3;
|
||||
}
|
||||
|
||||
private static PlayerType getPlayerType(Entity entity) {
|
||||
|
|
|
@ -8,7 +8,7 @@ import com.jozufozu.flywheel.light.LightProvider;
|
|||
import com.jozufozu.flywheel.light.LightUpdater;
|
||||
import com.jozufozu.flywheel.light.ListenerStatus;
|
||||
|
||||
import net.minecraft.world.LightType;
|
||||
import net.minecraft.world.level.LightLayer;
|
||||
|
||||
public abstract class ContraptionLighter<C extends Contraption> implements ILightUpdateListener {
|
||||
protected final C contraption;
|
||||
|
@ -42,7 +42,7 @@ public abstract class ContraptionLighter<C extends Contraption> implements ILigh
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onLightUpdate(LightProvider world, LightType type, ImmutableBox changed) {
|
||||
public void onLightUpdate(LightProvider world, LightLayer type, ImmutableBox changed) {
|
||||
lightVolume.onLightUpdate(world, type, changed);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package com.simibubi.create.content.contraptions.components.structureMovement;
|
||||
|
||||
import static net.minecraft.util.text.TextFormatting.GRAY;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -23,12 +21,15 @@ public interface IDisplayAssemblyExceptions {
|
|||
if (!tooltip.isEmpty())
|
||||
tooltip.add(TextComponent.EMPTY);
|
||||
|
||||
tooltip.add(IHaveGoggleInformation.componentSpacing.plainCopy().append(Lang.translate("gui.assembly.exception").withStyle(ChatFormatting.GOLD)));
|
||||
tooltip.add(IHaveGoggleInformation.componentSpacing.plainCopy()
|
||||
.append(Lang.translate("gui.assembly.exception")
|
||||
.withStyle(ChatFormatting.GOLD)));
|
||||
|
||||
String text = e.component.getString();
|
||||
Arrays.stream(text.split("\n"))
|
||||
.forEach(l -> TooltipHelper.cutStringTextComponent(l, GRAY, WHITE)
|
||||
.forEach(c -> tooltip.add(IHaveGoggleInformation.componentSpacing.plainCopy().append(c))));
|
||||
.forEach(l -> TooltipHelper.cutStringTextComponent(l, ChatFormatting.GRAY, ChatFormatting.WHITE)
|
||||
.forEach(c -> tooltip.add(IHaveGoggleInformation.componentSpacing.plainCopy()
|
||||
.append(c))));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
package com.simibubi.create.content.contraptions.components.structureMovement;
|
||||
|
||||
import static net.minecraft.block.HorizontalFaceBlock.FACE;
|
||||
import static net.minecraft.state.properties.BlockStateProperties.FACING;
|
||||
import static net.minecraft.world.level.block.state.properties.BlockStateProperties.AXIS;
|
||||
import static net.minecraft.world.level.block.state.properties.BlockStateProperties.FACING;
|
||||
import static net.minecraft.world.level.block.state.properties.BlockStateProperties.HORIZONTAL_FACING;
|
||||
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.content.contraptions.base.DirectionalAxisKineticBlock;
|
||||
|
@ -30,6 +31,8 @@ import net.minecraft.world.level.block.state.properties.AttachFace;
|
|||
import net.minecraft.world.level.block.state.properties.BellAttachType;
|
||||
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
||||
import net.minecraft.world.level.block.state.properties.BooleanProperty;
|
||||
import net.minecraft.world.level.block.state.properties.DirectionProperty;
|
||||
import net.minecraft.world.level.block.state.properties.EnumProperty;
|
||||
import net.minecraft.world.level.block.state.properties.Half;
|
||||
import net.minecraft.world.level.block.state.properties.SlabType;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
|
@ -124,11 +127,10 @@ public class StructureTransform {
|
|||
|
||||
if (rotationAxis == Axis.Y) {
|
||||
if (block instanceof BellBlock) {
|
||||
if (state.getValue(BlockStateProperties.BELL_ATTACHMENT) == BellAttachType.DOUBLE_WALL) {
|
||||
if (state.getValue(BlockStateProperties.BELL_ATTACHMENT) == BellAttachType.DOUBLE_WALL)
|
||||
state = state.setValue(BlockStateProperties.BELL_ATTACHMENT, BellAttachType.SINGLE_WALL);
|
||||
}
|
||||
return state.setValue(FaceAttachedHorizontalDirectionalBlock.FACING,
|
||||
rotation.rotate(state.getValue(FaceAttachedHorizontalDirectionalBlock.FACING)));
|
||||
return state.setValue(BellBlock.FACING,
|
||||
rotation.rotate(state.getValue(BellBlock.FACING)));
|
||||
}
|
||||
return state.rotate(rotation);
|
||||
}
|
||||
|
@ -137,30 +139,32 @@ public class StructureTransform {
|
|||
return rotateChassis(state);
|
||||
|
||||
if (block instanceof FaceAttachedHorizontalDirectionalBlock) {
|
||||
Direction stateFacing = state.getValue(FaceAttachedHorizontalDirectionalBlock.FACING);
|
||||
AttachFace stateFace = state.getValue(FACE);
|
||||
DirectionProperty facingProperty = FaceAttachedHorizontalDirectionalBlock.FACING;
|
||||
EnumProperty<AttachFace> faceProperty = FaceAttachedHorizontalDirectionalBlock.FACE;
|
||||
Direction stateFacing = state.getValue(facingProperty);
|
||||
AttachFace stateFace = state.getValue(faceProperty);
|
||||
Direction forcedAxis = rotationAxis == Axis.Z ? Direction.EAST : Direction.SOUTH;
|
||||
|
||||
if (stateFacing.getAxis() == rotationAxis && stateFace == AttachFace.WALL)
|
||||
return state;
|
||||
|
||||
for (int i = 0; i < rotation.ordinal(); i++) {
|
||||
stateFace = state.getValue(FACE);
|
||||
stateFacing = state.getValue(FaceAttachedHorizontalDirectionalBlock.FACING);
|
||||
stateFace = state.getValue(faceProperty);
|
||||
stateFacing = state.getValue(facingProperty);
|
||||
|
||||
boolean b = state.getValue(FACE) == AttachFace.CEILING;
|
||||
state = state.setValue(HORIZONTAL_FACING, b ? forcedAxis : forcedAxis.getOpposite());
|
||||
boolean b = state.getValue(faceProperty) == AttachFace.CEILING;
|
||||
state = state.setValue(facingProperty, b ? forcedAxis : forcedAxis.getOpposite());
|
||||
|
||||
if (stateFace != AttachFace.WALL) {
|
||||
state = state.setValue(FACE, AttachFace.WALL);
|
||||
state = state.setValue(faceProperty, AttachFace.WALL);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (stateFacing.getAxisDirection() == AxisDirection.POSITIVE) {
|
||||
state = state.setValue(FACE, AttachFace.FLOOR);
|
||||
state = state.setValue(faceProperty, AttachFace.FLOOR);
|
||||
continue;
|
||||
}
|
||||
state = state.setValue(FACE, AttachFace.CEILING);
|
||||
state = state.setValue(faceProperty, AttachFace.CEILING);
|
||||
}
|
||||
|
||||
return state;
|
||||
|
|
|
@ -45,8 +45,8 @@ public class ClockworkBearingTileEntity extends KineticTileEntity
|
|||
|
||||
private float prevForcedAngle;
|
||||
|
||||
public ClockworkBearingTileEntity(BlockEntityType<? extends ClockworkBearingTileEntity> type) {
|
||||
super(type);
|
||||
public ClockworkBearingTileEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
|
||||
super(type, pos, state);
|
||||
setLazyTickRate(3);
|
||||
}
|
||||
|
||||
|
@ -310,7 +310,7 @@ public class ClockworkBearingTileEntity extends KineticTileEntity
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void fromTag(BlockState state, CompoundTag compound, boolean clientPacket) {
|
||||
protected void fromTag(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(state, compound, clientPacket);
|
||||
super.fromTag(compound, clientPacket);
|
||||
|
||||
if (!clientPacket)
|
||||
return;
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package com.simibubi.create.content.contraptions.components.structureMovement.bearing;
|
||||
|
||||
import static net.minecraft.state.properties.BlockStateProperties.FACING;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.simibubi.create.AllSoundEvents;
|
||||
|
@ -40,8 +38,8 @@ public class MechanicalBearingTileEntity extends GeneratingKineticTileEntity
|
|||
|
||||
private float prevAngle;
|
||||
|
||||
public MechanicalBearingTileEntity(BlockEntityType<? extends MechanicalBearingTileEntity> type) {
|
||||
super(type);
|
||||
public MechanicalBearingTileEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
|
||||
super(type, pos, state);
|
||||
setLazyTickRate(3);
|
||||
}
|
||||
|
||||
|
@ -75,9 +73,9 @@ public class MechanicalBearingTileEntity extends GeneratingKineticTileEntity
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void fromTag(BlockState state, CompoundTag compound, boolean clientPacket) {
|
||||
protected void fromTag(CompoundTag compound, boolean clientPacket) {
|
||||
if (wasMoved) {
|
||||
super.fromTag(state, compound, clientPacket);
|
||||
super.fromTag(compound, clientPacket);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -85,7 +83,7 @@ public class MechanicalBearingTileEntity extends GeneratingKineticTileEntity
|
|||
running = compound.getBoolean("Running");
|
||||
angle = compound.getFloat("Angle");
|
||||
lastException = AssemblyException.read(compound);
|
||||
super.fromTag(state, compound, clientPacket);
|
||||
super.fromTag(compound, clientPacket);
|
||||
if (!clientPacket)
|
||||
return;
|
||||
if (running) {
|
||||
|
@ -145,7 +143,7 @@ public class MechanicalBearingTileEntity extends GeneratingKineticTileEntity
|
|||
.getBlock() instanceof BearingBlock))
|
||||
return;
|
||||
|
||||
Direction direction = getBlockState().getValue(FACING);
|
||||
Direction direction = getBlockState().getValue(BearingBlock.FACING);
|
||||
BearingContraption contraption = new BearingContraption(isWindmill(), direction);
|
||||
try {
|
||||
if (!contraption.assemble(level, worldPosition))
|
||||
|
@ -263,12 +261,12 @@ public class MechanicalBearingTileEntity extends GeneratingKineticTileEntity
|
|||
BlockState blockState = getBlockState();
|
||||
if (!(contraption.getContraption() instanceof BearingContraption))
|
||||
return;
|
||||
if (!blockState.hasProperty(FACING))
|
||||
if (!blockState.hasProperty(BearingBlock.FACING))
|
||||
return;
|
||||
|
||||
this.movedContraption = contraption;
|
||||
setChanged();
|
||||
BlockPos anchor = worldPosition.relative(blockState.getValue(FACING));
|
||||
BlockPos anchor = worldPosition.relative(blockState.getValue(BearingBlock.FACING));
|
||||
movedContraption.setPos(anchor.getX(), anchor.getY(), anchor.getZ());
|
||||
if (!level.isClientSide) {
|
||||
this.running = true;
|
||||
|
|
|
@ -17,6 +17,7 @@ import com.simibubi.create.foundation.utility.placement.IPlacementHelper;
|
|||
import com.simibubi.create.foundation.utility.placement.PlacementHelpers;
|
||||
import com.simibubi.create.foundation.utility.placement.PlacementOffset;
|
||||
|
||||
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
|
|
|
@ -9,6 +9,7 @@ import com.simibubi.create.foundation.tileEntity.behaviour.scrollvalue.INamedIco
|
|||
import com.simibubi.create.foundation.tileEntity.behaviour.scrollvalue.ScrollOptionBehaviour;
|
||||
import com.simibubi.create.foundation.utility.Lang;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
|
@ -19,8 +20,8 @@ public class WindmillBearingTileEntity extends MechanicalBearingTileEntity {
|
|||
protected ScrollOptionBehaviour<RotationDirection> movementDirection;
|
||||
protected float lastGeneratedSpeed;
|
||||
|
||||
public WindmillBearingTileEntity(BlockEntityType<? extends MechanicalBearingTileEntity> type) {
|
||||
super(type);
|
||||
public WindmillBearingTileEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
|
||||
super(type, pos, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -64,10 +65,10 @@ public class WindmillBearingTileEntity extends MechanicalBearingTileEntity {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void fromTag(BlockState state, CompoundTag compound, boolean clientPacket) {
|
||||
protected void fromTag(CompoundTag compound, boolean clientPacket) {
|
||||
if (!wasMoved)
|
||||
lastGeneratedSpeed = compound.getFloat("LastGenerated");
|
||||
super.fromTag(state, compound, clientPacket);
|
||||
super.fromTag(compound, clientPacket);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,17 +1,5 @@
|
|||
package com.simibubi.create.content.contraptions.components.structureMovement.chassis;
|
||||
|
||||
import static net.minecraft.state.properties.BlockStateProperties.AXIS;
|
||||
|
||||
import javanet.minimport com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.BlockMovementChecks;
|
||||
import com.simibubi.create.foundation.config.AllConfigs;
|
||||
import com.simibubi.create.foundation.tileEntity.SmartTileEntity;
|
||||
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
|
||||
import com.simibubi.create.foundation.tileEntity.behaviour.CenteredSideValueBoxTransform;
|
||||
import com.simibubi.create.foundation.tileEntity.behaviour.scrollvalue.BulkScrollValueBehaviour;
|
||||
import com.simibubi.create.foundation.tileEntity.behaviour.scrollvalue.ScrollValueBehaviour;
|
||||
import com.simibubi.create.foundation.utility.Iterate;
|
||||
import com.simibubi.create.foundation.utility.Lang;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
|
@ -19,21 +7,6 @@ import java.util.LinkedList;
|
|||
import java.util.List;
|
||||
import java.util.Queue;
|
||||
import java.util.Set;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.Direction.Axis;
|
||||
import net.minecraft.core.Direction.AxisDirection;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.fml.DistExecutor;
|
||||
|
||||
ecraft.world.level.block.state.properties.BlockStatePropertiesport java.util.HashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Queue;
|
||||
import java.util.Set;
|
||||
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.BlockMovementChecks;
|
||||
|
@ -46,14 +19,14 @@ import com.simibubi.create.foundation.tileEntity.behaviour.scrollvalue.ScrollVal
|
|||
import com.simibubi.create.foundation.utility.Iterate;
|
||||
import com.simibubi.create.foundation.utility.Lang;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.state.properties.BlockStateProperties;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Direction.Axis;
|
||||
import net.minecraft.util.Direction.AxisDirection;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.Direction.Axis;
|
||||
import net.minecraft.core.Direction.AxisDirection;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.fml.DistExecutor;
|
||||
|
||||
|
@ -61,8 +34,8 @@ public class ChassisTileEntity extends SmartTileEntity {
|
|||
|
||||
ScrollValueBehaviour range;
|
||||
|
||||
public ChassisTileEntity(BlockEntityType<? extends ChassisTileEntity> type) {
|
||||
super(type);
|
||||
public ChassisTileEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
|
||||
super(type, pos, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -161,7 +134,7 @@ public class ChassisTileEntity extends SmartTileEntity {
|
|||
continue;
|
||||
if (!LinearChassisBlock.sameKind(state, neighbourState))
|
||||
continue;
|
||||
if (neighbourState.getValue(AXIS) != axis)
|
||||
if (neighbourState.getValue(LinearChassisBlock.AXIS) != axis)
|
||||
continue;
|
||||
|
||||
frontier.add(current);
|
||||
|
|
|
@ -14,6 +14,7 @@ import com.simibubi.create.foundation.utility.animation.LerpedFloat;
|
|||
import com.simibubi.create.foundation.utility.animation.LerpedFloat.Chaser;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
|
@ -27,8 +28,8 @@ public class StickerTileEntity extends SmartTileEntity implements IInstanceRende
|
|||
LerpedFloat piston;
|
||||
boolean update;
|
||||
|
||||
public StickerTileEntity(BlockEntityType<?> tileEntityTypeIn) {
|
||||
super(tileEntityTypeIn);
|
||||
public StickerTileEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
|
||||
super(type, pos, state);
|
||||
piston = LerpedFloat.linear();
|
||||
update = false;
|
||||
}
|
||||
|
@ -82,8 +83,8 @@ public class StickerTileEntity extends SmartTileEntity implements IInstanceRende
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void fromTag(BlockState state, CompoundTag compound, boolean clientPacket) {
|
||||
super.fromTag(state, compound, clientPacket);
|
||||
protected void fromTag(CompoundTag compound, boolean clientPacket) {
|
||||
super.fromTag(compound, clientPacket);
|
||||
if (clientPacket)
|
||||
update = true;
|
||||
}
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
package com.simibubi.create.content.contraptions.components.structureMovement.gantry;
|
||||
|
||||
import static net.minecraft.state.properties.BlockStateProperties.FACING;
|
||||
|
||||
import com.net.minimport com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.AllSoundEvents;
|
||||
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.AssemblyException;
|
||||
|
@ -10,6 +8,7 @@ import com.simibubi.create.content.contraptions.components.structureMovement.Con
|
|||
import com.simibubi.create.content.contraptions.components.structureMovement.IDisplayAssemblyExceptions;
|
||||
import com.simibubi.create.content.contraptions.relays.advanced.GantryShaftBlock;
|
||||
import com.simibubi.create.content.contraptions.relays.advanced.GantryShaftTileEntity;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.Direction.Axis;
|
||||
|
@ -18,29 +17,13 @@ import net.minecraft.world.level.block.entity.BlockEntity;
|
|||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
||||
ecraft.world.level.block.state.properties.BlockStatePropertiesate.AllSoundEvents;
|
||||
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.AssemblyException;
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.ContraptionCollider;
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.IDisplayAssemblyExceptions;
|
||||
import com.simibubi.create.content.contraptions.relays.advanced.GantryShaftBlock;
|
||||
import com.simibubi.create.content.contraptions.relays.advanced.GantryShaftTileEntity;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Direction.Axis;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
public class GantryCarriageTileEntity extends KineticTileEntity implements IDisplayAssemblyExceptions {
|
||||
|
||||
boolean assembleNextTick;
|
||||
protected AssemblyException lastException;
|
||||
|
||||
public GantryCarriageTileEntity(BlockEntityType<?> typeIn) {
|
||||
super(typeIn);
|
||||
public GantryCarriageTileEntity(BlockEntityType<?> typeIn, BlockPos pos, BlockState state) {
|
||||
super(typeIn, pos, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -87,7 +70,7 @@ public class GantryCarriageTileEntity extends KineticTileEntity implements IDisp
|
|||
if (!(blockState.getBlock() instanceof GantryCarriageBlock))
|
||||
return;
|
||||
|
||||
Direction direction = blockState.getValue(FACING);
|
||||
Direction direction = blockState.getValue(GantryCarriageBlock.FACING);
|
||||
GantryContraption contraption = new GantryContraption(direction);
|
||||
|
||||
BlockEntity shaftTe = level.getBlockEntity(worldPosition.relative(direction.getOpposite()));
|
||||
|
@ -134,9 +117,9 @@ public class GantryCarriageTileEntity extends KineticTileEntity implements IDisp
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void fromTag(BlockState state, CompoundTag compound, boolean clientPacket) {
|
||||
protected void fromTag(CompoundTag compound, boolean clientPacket) {
|
||||
lastException = AssemblyException.read(compound);
|
||||
super.fromTag(state, compound, clientPacket);
|
||||
super.fromTag(compound, clientPacket);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -14,7 +14,6 @@ import com.jozufozu.flywheel.core.instancing.ConditionalInstance;
|
|||
import com.jozufozu.flywheel.core.materials.oriented.OrientedData;
|
||||
import com.jozufozu.flywheel.core.model.IModel;
|
||||
import com.mojang.math.Quaternion;
|
||||
import com.mojang.math.Vector3d;
|
||||
import com.simibubi.create.AllItems;
|
||||
import com.simibubi.create.AllStitchedTextures;
|
||||
import com.simibubi.create.Create;
|
||||
|
@ -24,9 +23,11 @@ import com.simibubi.create.foundation.utility.VecHelper;
|
|||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.LightType;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.level.LightLayer;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
|
||||
public class GlueInstance extends EntityInstance<SuperGlueEntity> implements ITickableInstance {
|
||||
|
||||
|
@ -82,12 +83,12 @@ public class GlueInstance extends EntityInstance<SuperGlueEntity> implements ITi
|
|||
|
||||
private void updateLight(OrientedData model) {
|
||||
BlockPos pos = entity.getHangingPosition();
|
||||
model.setBlockLight(world.getBrightness(LightType.BLOCK, pos))
|
||||
.setSkyLight(world.getBrightness(LightType.SKY, pos));
|
||||
model.setBlockLight(world.getBrightness(LightLayer.BLOCK, pos))
|
||||
.setSkyLight(world.getBrightness(LightLayer.SKY, pos));
|
||||
}
|
||||
|
||||
private boolean shouldShow() {
|
||||
PlayerEntity player = Minecraft.getInstance().player;
|
||||
Player player = Minecraft.getInstance().player;
|
||||
|
||||
return entity.isVisible()
|
||||
|| AllItems.SUPER_GLUE.isIn(player.getMainHandItem())
|
||||
|
@ -97,29 +98,29 @@ public class GlueInstance extends EntityInstance<SuperGlueEntity> implements ITi
|
|||
public static class GlueModel implements IModel {
|
||||
@Override
|
||||
public void buffer(VecBuffer buffer) {
|
||||
Vector3d diff = Vector3d.atLowerCornerOf(Direction.SOUTH.getNormal());
|
||||
Vector3d extension = diff.normalize()
|
||||
Vec3 diff = Vec3.atLowerCornerOf(Direction.SOUTH.getNormal());
|
||||
Vec3 extension = diff.normalize()
|
||||
.scale(1 / 32f - 1 / 128f);
|
||||
|
||||
Vector3d plane = VecHelper.axisAlingedPlaneOf(diff);
|
||||
Vec3 plane = VecHelper.axisAlingedPlaneOf(diff);
|
||||
Direction.Axis axis = Direction.getNearest(diff.x, diff.y, diff.z)
|
||||
.getAxis();
|
||||
|
||||
Vector3d start = Vector3d.ZERO.subtract(extension);
|
||||
Vector3d end = Vector3d.ZERO.add(extension);
|
||||
Vec3 start = Vec3.ZERO.subtract(extension);
|
||||
Vec3 end = Vec3.ZERO.add(extension);
|
||||
|
||||
plane = plane.scale(1 / 2f);
|
||||
Vector3d a1 = plane.add(start);
|
||||
Vector3d b1 = plane.add(end);
|
||||
Vec3 a1 = plane.add(start);
|
||||
Vec3 b1 = plane.add(end);
|
||||
plane = VecHelper.rotate(plane, -90, axis);
|
||||
Vector3d a2 = plane.add(start);
|
||||
Vector3d b2 = plane.add(end);
|
||||
Vec3 a2 = plane.add(start);
|
||||
Vec3 b2 = plane.add(end);
|
||||
plane = VecHelper.rotate(plane, -90, axis);
|
||||
Vector3d a3 = plane.add(start);
|
||||
Vector3d b3 = plane.add(end);
|
||||
Vec3 a3 = plane.add(start);
|
||||
Vec3 b3 = plane.add(end);
|
||||
plane = VecHelper.rotate(plane, -90, axis);
|
||||
Vector3d a4 = plane.add(start);
|
||||
Vector3d b4 = plane.add(end);
|
||||
Vec3 a4 = plane.add(start);
|
||||
Vec3 b4 = plane.add(end);
|
||||
|
||||
float minU;
|
||||
float maxU;
|
||||
|
|
|
@ -67,7 +67,8 @@ import net.minecraftforge.fmllegacy.common.registry.IEntityAdditionalSpawnData;
|
|||
import net.minecraftforge.fmllegacy.network.NetworkHooks;
|
||||
import net.minecraftforge.fmllegacy.network.PacketDistributor;
|
||||
|
||||
public class SuperGlueEntity extends Entity implements IEntityAdditionalSpawnData, ISpecialEntityItemRequirement, IInstanceRendered {
|
||||
public class SuperGlueEntity extends Entity
|
||||
implements IEntityAdditionalSpawnData, ISpecialEntityItemRequirement, IInstanceRendered {
|
||||
|
||||
private int validationTimer;
|
||||
protected BlockPos hangingPosition;
|
||||
|
@ -112,16 +113,16 @@ public class SuperGlueEntity extends Entity implements IEntityAdditionalSpawnDat
|
|||
Validate.notNull(getFacingDirection());
|
||||
if (getFacingDirection().getAxis()
|
||||
.isHorizontal()) {
|
||||
this.xRot = 0.0F;
|
||||
this.yRot = getFacingDirection().get2DDataValue() * 90;
|
||||
setXRot(0);
|
||||
setYRot(getFacingDirection().get2DDataValue() * 90);
|
||||
} else {
|
||||
this.xRot = -90 * getFacingDirection().getAxisDirection()
|
||||
.getStep();
|
||||
this.yRot = 0.0F;
|
||||
setXRot(-90 * getFacingDirection().getAxisDirection()
|
||||
.getStep());
|
||||
setYRot(0);
|
||||
}
|
||||
|
||||
this.xRotO = this.xRot;
|
||||
this.yRotO = this.yRot;
|
||||
this.xRotO = this.getXRot();
|
||||
this.yRotO = this.getYRot();
|
||||
this.updateBoundingBox();
|
||||
}
|
||||
|
||||
|
@ -162,7 +163,7 @@ public class SuperGlueEntity extends Entity implements IEntityAdditionalSpawnDat
|
|||
if (this.validationTimer++ == 10 && !this.level.isClientSide) {
|
||||
this.validationTimer = 0;
|
||||
if (isAlive() && !this.onValidSurface()) {
|
||||
remove();
|
||||
kill();
|
||||
onBroken(null);
|
||||
}
|
||||
}
|
||||
|
@ -189,13 +190,13 @@ public class SuperGlueEntity extends Entity implements IEntityAdditionalSpawnDat
|
|||
if (!level.isAreaLoaded(pos, 0) || !level.isAreaLoaded(pos2, 0))
|
||||
return true;
|
||||
if (!isValidFace(level, pos2, getFacingDirection())
|
||||
&& !isValidFace(level, pos, getFacingDirection().getOpposite()))
|
||||
&& !isValidFace(level, pos, getFacingDirection().getOpposite()))
|
||||
return false;
|
||||
if (isSideSticky(level, pos2, getFacingDirection())
|
||||
|| isSideSticky(level, pos, getFacingDirection().getOpposite()))
|
||||
|| isSideSticky(level, pos, getFacingDirection().getOpposite()))
|
||||
return false;
|
||||
return level.getEntities(this, getBoundingBox(), e -> e instanceof SuperGlueEntity)
|
||||
.isEmpty();
|
||||
.isEmpty();
|
||||
}
|
||||
|
||||
public static boolean isValidFace(Level world, BlockPos pos, Direction direction) {
|
||||
|
@ -249,9 +250,7 @@ public class SuperGlueEntity extends Entity implements IEntityAdditionalSpawnDat
|
|||
|
||||
@Override
|
||||
public boolean skipAttackInteraction(Entity entity) {
|
||||
return entity instanceof Player
|
||||
? hurt(DamageSource.playerAttack((Player) entity), 0)
|
||||
: false;
|
||||
return entity instanceof Player ? hurt(DamageSource.playerAttack((Player) entity), 0) : false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -264,7 +263,8 @@ public class SuperGlueEntity extends Entity implements IEntityAdditionalSpawnDat
|
|||
if (this.isInvulnerableTo(source))
|
||||
return false;
|
||||
|
||||
boolean mobGriefing = level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING);
|
||||
boolean mobGriefing = level.getGameRules()
|
||||
.getBoolean(GameRules.RULE_MOBGRIEFING);
|
||||
Entity trueSource = source.getEntity();
|
||||
if (!mobGriefing && trueSource instanceof Mob)
|
||||
return false;
|
||||
|
@ -276,7 +276,7 @@ public class SuperGlueEntity extends Entity implements IEntityAdditionalSpawnDat
|
|||
}
|
||||
|
||||
if (isAlive() && !level.isClientSide) {
|
||||
remove();
|
||||
kill();
|
||||
markHurt();
|
||||
onBroken(source.getEntity());
|
||||
}
|
||||
|
@ -287,7 +287,7 @@ public class SuperGlueEntity extends Entity implements IEntityAdditionalSpawnDat
|
|||
@Override
|
||||
public void move(MoverType typeIn, Vec3 pos) {
|
||||
if (!level.isClientSide && isAlive() && pos.lengthSqr() > 0.0D) {
|
||||
remove();
|
||||
discard();
|
||||
onBroken(null);
|
||||
}
|
||||
}
|
||||
|
@ -295,7 +295,7 @@ public class SuperGlueEntity extends Entity implements IEntityAdditionalSpawnDat
|
|||
@Override
|
||||
public void push(double x, double y, double z) {
|
||||
if (!level.isClientSide && isAlive() && x * x + y * y + z * z > 0.0D) {
|
||||
remove();
|
||||
discard();
|
||||
onBroken(null);
|
||||
}
|
||||
}
|
||||
|
@ -334,8 +334,7 @@ public class SuperGlueEntity extends Entity implements IEntityAdditionalSpawnDat
|
|||
|
||||
LocalPlayer cPlayer = (LocalPlayer) player;
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
HitResult ray =
|
||||
cPlayer.pick(mc.gameMode.getPickRange(), AnimationTickHolder.getPartialTicks(), false);
|
||||
HitResult ray = cPlayer.pick(mc.gameMode.getPickRange(), AnimationTickHolder.getPartialTicks(), false);
|
||||
|
||||
if (!(ray instanceof BlockHitResult))
|
||||
return;
|
||||
|
@ -423,7 +422,7 @@ public class SuperGlueEntity extends Entity implements IEntityAdditionalSpawnDat
|
|||
}
|
||||
}
|
||||
|
||||
float f = Mth.wrapDegrees(this.yRot);
|
||||
float f = Mth.wrapDegrees(this.getYRot());
|
||||
switch (transformRotation) {
|
||||
case CLOCKWISE_180:
|
||||
return f + 180.0F;
|
||||
|
|
|
@ -2,3 +2,5 @@
|
|||
package com.simibubi.create.content.contraptions.components.structureMovement.glue;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||
|
|
|
@ -185,7 +185,7 @@ public class CartAssemblerBlock extends BaseRailBlock
|
|||
|
||||
if (!player.isCreative()) {
|
||||
itemStack.shrink(1);
|
||||
player.inventory.placeItemBackInInventory(world, new ItemStack(previousItem));
|
||||
player.getInventory().placeItemBackInInventory(new ItemStack(previousItem));
|
||||
}
|
||||
return InteractionResult.SUCCESS;
|
||||
}
|
||||
|
@ -286,7 +286,7 @@ public class CartAssemblerBlock extends BaseRailBlock
|
|||
return InteractionResult.SUCCESS;
|
||||
if (player != null && !player.isCreative())
|
||||
getDropsNoRail(state, (ServerLevel) world, pos, world.getBlockEntity(pos), player, context.getItemInHand())
|
||||
.forEach(itemStack -> player.inventory.placeItemBackInInventory(world, itemStack));
|
||||
.forEach(itemStack -> player.getInventory().placeItemBackInInventory(itemStack));
|
||||
if (world instanceof ServerLevel)
|
||||
state.spawnAfterBreak((ServerLevel) world, pos, ItemStack.EMPTY);
|
||||
world.setBlockAndUpdate(pos, getRailBlock(state));
|
||||
|
|
|
@ -49,8 +49,8 @@ public class CartAssemblerTileEntity extends SmartTileEntity implements IDisplay
|
|||
protected AssemblyException lastException;
|
||||
protected AbstractMinecart cartToAssemble;
|
||||
|
||||
public CartAssemblerTileEntity(BlockEntityType<? extends CartAssemblerTileEntity> type) {
|
||||
super(type);
|
||||
public CartAssemblerTileEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
|
||||
super(type, pos, state);
|
||||
ticksSinceMinecartUpdate = assemblyCooldown;
|
||||
}
|
||||
|
||||
|
@ -242,9 +242,9 @@ public class CartAssemblerTileEntity extends SmartTileEntity implements IDisplay
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void fromTag(BlockState state, CompoundTag compound, boolean clientPacket) {
|
||||
protected void fromTag(CompoundTag compound, boolean clientPacket) {
|
||||
lastException = AssemblyException.read(compound);
|
||||
super.fromTag(state, compound, clientPacket);
|
||||
super.fromTag(compound, clientPacket);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.simibubi.create.content.contraptions.components.structureMovement.mo
|
|||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||
import net.minecraft.world.Container;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraftforge.items.IItemHandlerModifiable;
|
||||
|
|
|
@ -245,7 +245,7 @@ public class MinecartContraptionItem extends Item {
|
|||
return;
|
||||
}
|
||||
|
||||
player.inventory.placeItemBackInInventory(event.getWorld(), generatedStack);
|
||||
player.getInventory().placeItemBackInInventory(event.getWorld(), generatedStack);
|
||||
contraption.remove();
|
||||
entity.remove();
|
||||
event.setCancellationResult(InteractionResult.SUCCESS);
|
||||
|
|
|
@ -36,8 +36,8 @@ public abstract class LinearActuatorTileEntity extends KineticTileEntity
|
|||
// Custom position sync
|
||||
protected float clientOffsetDiff;
|
||||
|
||||
public LinearActuatorTileEntity(BlockEntityType<?> typeIn) {
|
||||
super(typeIn);
|
||||
public LinearActuatorTileEntity(BlockEntityType<?> typeIn, BlockPos pos, BlockState state) {
|
||||
super(typeIn, pos, state);
|
||||
setLazyTickRate(3);
|
||||
forceMove = true;
|
||||
}
|
||||
|
@ -179,7 +179,7 @@ public abstract class LinearActuatorTileEntity extends KineticTileEntity
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void fromTag(BlockState state, CompoundTag compound, boolean clientPacket) {
|
||||
protected void fromTag(CompoundTag compound, boolean clientPacket) {
|
||||
boolean forceMovement = compound.contains("ForceMovement");
|
||||
float offsetBefore = offset;
|
||||
|
||||
|
@ -187,7 +187,7 @@ public abstract class LinearActuatorTileEntity extends KineticTileEntity
|
|||
waitingForSpeedChange = compound.getBoolean("Waiting");
|
||||
offset = compound.getFloat("Offset");
|
||||
lastException = AssemblyException.read(compound);
|
||||
super.fromTag(state, compound, clientPacket);
|
||||
super.fromTag(compound, clientPacket);
|
||||
|
||||
if (!clientPacket)
|
||||
return;
|
||||
|
|
|
@ -27,14 +27,14 @@ public class MechanicalPistonTileEntity extends LinearActuatorTileEntity {
|
|||
protected boolean hadCollisionWithOtherPiston;
|
||||
protected int extensionLength;
|
||||
|
||||
public MechanicalPistonTileEntity(BlockEntityType<? extends MechanicalPistonTileEntity> type) {
|
||||
super(type);
|
||||
public MechanicalPistonTileEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
|
||||
super(type, pos, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void fromTag(BlockState state, CompoundTag compound, boolean clientPacket) {
|
||||
protected void fromTag(CompoundTag compound, boolean clientPacket) {
|
||||
extensionLength = compound.getInt("ExtensionLength");
|
||||
super.fromTag(state, compound, clientPacket);
|
||||
super.fromTag(compound, clientPacket);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -6,35 +6,11 @@ import static com.simibubi.create.content.contraptions.components.structureMovem
|
|||
import static com.simibubi.create.content.contraptions.components.structureMovement.piston.MechanicalPistonBlock.isPiston;
|
||||
import static com.simibubi.create.content.contraptions.components.structureMovement.piston.MechanicalPistonBlock.isPistonHead;
|
||||
import static com.simibubi.create.content.contraptions.components.structureMovement.piston.MechanicalPistonBlock.isStickyPiston;
|
||||
import static net.minecraft.state.properties.BlockStateProperties.FACING;
|
||||
import static net.minecraft.world.level.block.state.properties.BlockStateProperties.FACING;
|
||||
|
||||
import javanet.minimport com.simibubi.create.content.contraptions.components.structureMovement.AssemblyException;
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.BlockMovementChecks;
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.ContraptionLighter;
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.ContraptionType;
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.TranslatingContraption;
|
||||
import com.simibubi.create.foundation.config.AllConfigs;
|
||||
import com.simibubi.create.foundation.utility.VecHelper;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Queue;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.LevelAccessor;
|
||||
import net.minecraft.world.level.block.WoolCarpetBlock;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.state.properties.PistonType;
|
||||
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate.StructureBlockInfo;
|
||||
import net.minecraft.world.level.material.PushReaction;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
ecraft.world.level.block.state.properties.BlockStatePropertiesva.util.Queue;
|
||||
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
|
@ -47,19 +23,19 @@ import com.simibubi.create.content.contraptions.components.structureMovement.pis
|
|||
import com.simibubi.create.foundation.config.AllConfigs;
|
||||
import com.simibubi.create.foundation.utility.VecHelper;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.CarpetBlock;
|
||||
import net.minecraft.block.material.PushReaction;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.state.properties.BlockStateProperties;
|
||||
import net.minecraft.state.properties.PistonType;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IWorld;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.gen.feature.template.Template.BlockInfo;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.LevelAccessor;
|
||||
import net.minecraft.world.level.block.WoolCarpetBlock;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
||||
import net.minecraft.world.level.block.state.properties.PistonType;
|
||||
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate.StructureBlockInfo;
|
||||
import net.minecraft.world.level.material.PushReaction;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
|
@ -166,7 +142,7 @@ public class PistonContraption extends TranslatingContraption {
|
|||
BlockPos relPos = pole.pos.relative(direction, -extensionsInFront);
|
||||
BlockPos localPos = relPos.subtract(anchor);
|
||||
getBlocks().put(localPos, new StructureBlockInfo(localPos, pole.state, null));
|
||||
//pistonExtensionCollisionBox = pistonExtensionCollisionBox.union(new AxisAlignedBB(localPos));
|
||||
//pistonExtensionCollisionBox = pistonExtensionCollisionBox.union(new AABB(localPos));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -188,7 +164,7 @@ public class PistonContraption extends TranslatingContraption {
|
|||
if (offset == 1 && retracting)
|
||||
return true;
|
||||
BlockPos currentPos = pos.relative(orientation, offset + initialExtensionProgress);
|
||||
if (retracting && Level.isOutsideBuildHeight(currentPos))
|
||||
if (retracting && world.isOutsideBuildHeight(currentPos))
|
||||
return true;
|
||||
if (!world.isLoaded(currentPos))
|
||||
throw AssemblyException.unloadedChunk(currentPos);
|
||||
|
|
|
@ -15,6 +15,7 @@ import com.simibubi.create.foundation.utility.placement.IPlacementHelper;
|
|||
import com.simibubi.create.foundation.utility.placement.PlacementHelpers;
|
||||
import com.simibubi.create.foundation.utility.placement.util.PoleHelper;
|
||||
|
||||
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.Direction.Axis;
|
||||
|
|
|
@ -18,8 +18,9 @@ import com.mojang.math.Vector3f;
|
|||
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
||||
import com.simibubi.create.content.contraptions.relays.encased.ShaftInstance;
|
||||
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.world.LightType;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.level.LightLayer;
|
||||
|
||||
public abstract class AbstractPulleyInstance extends ShaftInstance implements IDynamicInstance, IMovingListener {
|
||||
|
||||
|
@ -71,7 +72,7 @@ public abstract class AbstractPulleyInstance extends ShaftInstance implements ID
|
|||
magnet.update()
|
||||
.get()
|
||||
.ifPresent(data -> {
|
||||
int i = Math.max(0, MathHelper.floor(offset));
|
||||
int i = Math.max(0, Mth.floor(offset));
|
||||
short packed = light.getPackedLight(pos.getX(), pos.getY() - i, pos.getZ());
|
||||
data.setPosition(getInstancePosition())
|
||||
.nudge(0, -offset, 0)
|
||||
|
@ -149,7 +150,7 @@ public abstract class AbstractPulleyInstance extends ShaftInstance implements ID
|
|||
}
|
||||
|
||||
private boolean updateVolume() {
|
||||
int length = MathHelper.ceil(offset) + 2;
|
||||
int length = Mth.ceil(offset) + 2;
|
||||
|
||||
if (volume.sizeY() < length) {
|
||||
volume.assign(pos.below(length), pos)
|
||||
|
@ -164,7 +165,7 @@ public abstract class AbstractPulleyInstance extends ShaftInstance implements ID
|
|||
}
|
||||
|
||||
private int getNeededRopeCount() {
|
||||
return Math.max(0, MathHelper.ceil(offset - 1.25f));
|
||||
return Math.max(0, Mth.ceil(offset - 1.25f));
|
||||
}
|
||||
|
||||
private boolean shouldRenderHalfRope() {
|
||||
|
@ -191,7 +192,7 @@ public abstract class AbstractPulleyInstance extends ShaftInstance implements ID
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onLightUpdate(LightProvider world, LightType type, ImmutableBox changed) {
|
||||
public void onLightUpdate(LightProvider world, LightLayer type, ImmutableBox changed) {
|
||||
super.onLightUpdate(world, type, changed);
|
||||
light.onLightUpdate(world, type, changed);
|
||||
}
|
||||
|
|
|
@ -44,16 +44,18 @@ public abstract class AbstractPulleyRenderer extends KineticTileEntityRenderer {
|
|||
protected void renderSafe(KineticTileEntity te, float partialTicks, PoseStack ms, MultiBufferSource buffer,
|
||||
int light, int overlay) {
|
||||
|
||||
if (Backend.getInstance().canUseInstancing(te.getLevel())) return;
|
||||
if (Backend.getInstance()
|
||||
.canUseInstancing(te.getLevel()))
|
||||
return;
|
||||
|
||||
super.renderSafe(te, partialTicks, ms, buffer, light, overlay);
|
||||
float offset = getOffset(te, partialTicks);
|
||||
boolean running = isRunning(te);
|
||||
|
||||
Axis rotationAxis = ((IRotate) te.getBlockState()
|
||||
.getBlock()).getRotationAxis(te.getBlockState());
|
||||
.getBlock()).getRotationAxis(te.getBlockState());
|
||||
kineticRotationTransform(getRotatedCoil(te), te, rotationAxis, AngleHelper.rad(offset * 180), light)
|
||||
.renderInto(ms, buffer.getBuffer(RenderType.solid()));
|
||||
.renderInto(ms, buffer.getBuffer(RenderType.solid()));
|
||||
|
||||
Level world = te.getLevel();
|
||||
BlockState blockState = te.getBlockState();
|
||||
|
@ -107,7 +109,13 @@ public abstract class AbstractPulleyRenderer extends KineticTileEntityRenderer {
|
|||
|
||||
protected SuperByteBuffer getRotatedCoil(KineticTileEntity te) {
|
||||
BlockState blockState = te.getBlockState();
|
||||
return PartialBufferer.getFacing(getCoil(), blockState, Direction.get(AxisDirection.POSITIVE, getShaftAxis(te)));
|
||||
return PartialBufferer.getFacing(getCoil(), blockState,
|
||||
Direction.get(AxisDirection.POSITIVE, getShaftAxis(te)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getViewDistance() {
|
||||
return 256;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -63,4 +63,10 @@ public class PulleyRenderer extends AbstractPulleyRenderer {
|
|||
|
||||
return offset;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getViewDistance() {
|
||||
return 128;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ import net.minecraft.core.BlockPos;
|
|||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.entity.Entity.RemovalReason;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.SimpleWaterloggedBlock;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
|
@ -29,8 +30,8 @@ public class PulleyTileEntity extends LinearActuatorTileEntity {
|
|||
protected int initialOffset;
|
||||
private float prevAnimatedOffset;
|
||||
|
||||
public PulleyTileEntity(BlockEntityType<? extends PulleyTileEntity> type) {
|
||||
super(type);
|
||||
public PulleyTileEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
|
||||
super(type, pos, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -38,11 +39,6 @@ public class PulleyTileEntity extends LinearActuatorTileEntity {
|
|||
return super.makeRenderBoundingBox().expandTowards(0, -offset, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getViewDistance() {
|
||||
return super.getViewDistance() + offset * offset;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
|
@ -157,7 +153,7 @@ public class PulleyTileEntity extends LinearActuatorTileEntity {
|
|||
}
|
||||
|
||||
if (movedContraption != null)
|
||||
movedContraption.remove();
|
||||
movedContraption.remove(RemovalReason.KILLED);
|
||||
movedContraption = null;
|
||||
initialOffset = 0;
|
||||
running = false;
|
||||
|
@ -196,9 +192,9 @@ public class PulleyTileEntity extends LinearActuatorTileEntity {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void fromTag(BlockState state, CompoundTag compound, boolean clientPacket) {
|
||||
protected void fromTag(CompoundTag compound, boolean clientPacket) {
|
||||
initialOffset = compound.getInt("InitialOffset");
|
||||
super.fromTag(state, compound, clientPacket);
|
||||
super.fromTag(compound, clientPacket);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -9,13 +9,13 @@ import org.apache.commons.lang3.tuple.Pair;
|
|||
|
||||
import com.jozufozu.flywheel.backend.instancing.tile.TileInstanceManager;
|
||||
import com.jozufozu.flywheel.backend.material.MaterialManagerImpl;
|
||||
import com.jozufozu.flywheel.backend.pipeline.Template;
|
||||
import com.simibubi.create.AllMovementBehaviours;
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.MovementBehaviour;
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext;
|
||||
|
||||
import net.minecraft.client.renderer.ActiveRenderInfo;
|
||||
import net.minecraft.client.Camera;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate.StructureBlockInfo;
|
||||
|
||||
public class ContraptionInstanceManager extends TileInstanceManager {
|
||||
|
||||
|
@ -33,7 +33,7 @@ public class ContraptionInstanceManager extends TileInstanceManager {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void beginFrame(ActiveRenderInfo info) {
|
||||
public void beginFrame(Camera info) {
|
||||
super.beginFrame(info);
|
||||
|
||||
actors.forEach(ActorInstance::beginFrame);
|
||||
|
@ -45,8 +45,8 @@ public class ContraptionInstanceManager extends TileInstanceManager {
|
|||
}
|
||||
|
||||
@Nullable
|
||||
public ActorInstance createActor(Pair<Template.BlockInfo, MovementContext> actor) {
|
||||
Template.BlockInfo blockInfo = actor.getLeft();
|
||||
public ActorInstance createActor(Pair<StructureBlockInfo, MovementContext> actor) {
|
||||
StructureBlockInfo blockInfo = actor.getLeft();
|
||||
MovementContext context = actor.getRight();
|
||||
|
||||
MovementBehaviour movementBehaviour = AllMovementBehaviours.of(blockInfo.state);
|
||||
|
|
|
@ -14,7 +14,7 @@ import com.jozufozu.flywheel.backend.model.ModelRenderer;
|
|||
import com.jozufozu.flywheel.core.model.IModel;
|
||||
import com.jozufozu.flywheel.core.model.WorldModel;
|
||||
import com.jozufozu.flywheel.event.BeginFrameEvent;
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.math.Matrix4f;
|
||||
import com.mojang.math.Vector3d;
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.AbstractContraptionEntity;
|
||||
|
@ -26,9 +26,9 @@ import com.simibubi.create.foundation.utility.worldWrappers.PlacementSimulationW
|
|||
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
|
||||
public class RenderedContraption extends ContraptionRenderInfo {
|
||||
|
@ -89,7 +89,7 @@ public class RenderedContraption extends ContraptionRenderInfo {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setupMatrices(MatrixStack viewProjection, double camX, double camY, double camZ) {
|
||||
public void setupMatrices(PoseStack viewProjection, double camX, double camY, double camZ) {
|
||||
super.setupMatrices(viewProjection, camX, camY, camZ);
|
||||
|
||||
if (!modelViewPartialReady) {
|
||||
|
@ -139,16 +139,15 @@ public class RenderedContraption extends ContraptionRenderInfo {
|
|||
}
|
||||
|
||||
private void buildInstancedTiles() {
|
||||
Collection<TileEntity> tileEntities = contraption.maybeInstancedTileEntities;
|
||||
Collection<BlockEntity> tileEntities = contraption.maybeInstancedTileEntities;
|
||||
if (!tileEntities.isEmpty()) {
|
||||
for (TileEntity te : tileEntities) {
|
||||
for (BlockEntity te : tileEntities) {
|
||||
if (InstancedRenderRegistry.getInstance()
|
||||
.canInstance(te.getType())) {
|
||||
World world = te.getLevel();
|
||||
BlockPos pos = te.getBlockPos();
|
||||
te.setLevelAndPosition(renderWorld, pos);
|
||||
Level world = te.getLevel();
|
||||
te.setLevel(renderWorld);
|
||||
kinetics.add(te);
|
||||
te.setLevelAndPosition(world, pos);
|
||||
te.setLevel(world);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -159,9 +158,9 @@ public class RenderedContraption extends ContraptionRenderInfo {
|
|||
}
|
||||
|
||||
public static void setupModelViewPartial(Matrix4f matrix, Matrix4f modelMatrix, AbstractContraptionEntity entity, double camX, double camY, double camZ, float pt) {
|
||||
float x = (float) (MathHelper.lerp(pt, entity.xOld, entity.getX()) - camX);
|
||||
float y = (float) (MathHelper.lerp(pt, entity.yOld, entity.getY()) - camY);
|
||||
float z = (float) (MathHelper.lerp(pt, entity.zOld, entity.getZ()) - camZ);
|
||||
float x = (float) (Mth.lerp(pt, entity.xOld, entity.getX()) - camX);
|
||||
float y = (float) (Mth.lerp(pt, entity.yOld, entity.getY()) - camY);
|
||||
float z = (float) (Mth.lerp(pt, entity.zOld, entity.getZ()) - camZ);
|
||||
matrix.setTranslation(x, y, z);
|
||||
matrix.multiply(modelMatrix);
|
||||
}
|
||||
|
|
|
@ -2,3 +2,5 @@
|
|||
package com.simibubi.create.content.contraptions.components.structureMovement.render;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||
|
|
|
@ -52,9 +52,9 @@ public class CouplingHandlerClient {
|
|||
selectedCart = null;
|
||||
}
|
||||
|
||||
private static void spawnSelectionParticles(AABB axisAlignedBB, boolean highlight) {
|
||||
private static void spawnSelectionParticles(AABB AABB, boolean highlight) {
|
||||
ClientLevel world = Minecraft.getInstance().level;
|
||||
Vec3 center = axisAlignedBB.getCenter();
|
||||
Vec3 center = AABB.getCenter();
|
||||
int amount = highlight ? 100 : 2;
|
||||
ParticleOptions particleData = highlight ? ParticleTypes.END_ROD : new DustParticleOptions(1, 1, 1, 1);
|
||||
for (int i = 0; i < amount; i++) {
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package com.simibubi.create.content.contraptions.components.structureMovement.train;
|
||||
|
||||
import static net.minecraft.util.math.MathHelpimport com.jozufozu.flywheel.util.transform.MatrixTransformStack;
|
||||
import static net.minecraft.util.Mth.lerp;
|
||||
|
||||
import com.jozufozu.flywheel.util.transform.MatrixTransformStack;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||
import com.mojang.math.Vector3f;
|
||||
|
@ -14,6 +16,7 @@ import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
|||
import com.simibubi.create.foundation.utility.Color;
|
||||
import com.simibubi.create.foundation.utility.Couple;
|
||||
import com.simibubi.create.foundation.utility.VecHelper;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.multiplayer.ClientLevel;
|
||||
import net.minecraft.client.renderer.LevelRenderer;
|
||||
|
@ -21,41 +24,12 @@ import net.minecraft.client.renderer.MultiBufferSource;
|
|||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction.Axis;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.entity.vehicle.AbstractMinecart;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
|
||||
er.lerp;
|
||||
|
||||
import com.net.minecraft.util.MthatrixTransformStack;
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
||||
import com.simibubi.create.AllBlockPartials;
|
||||
import com.simibubi.create.CreateClient;
|
||||
import com.simibubi.create.content.contraptions.KineticDebugger;
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.train.capability.MinecartController;
|
||||
import com.simibubi.create.foundation.render.PartialBufferer;
|
||||
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
||||
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
||||
import com.simibubi.create.foundation.utility.Color;
|
||||
import com.simibubi.create.foundation.utility.Couple;
|
||||
import com.simibubi.create.foundation.utility.VecHelper;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.WorldRenderer;
|
||||
import net.minecraft.client.world.ClientWorld;
|
||||
import net.minecraft.entity.item.minecart.AbstractMinecartEntity;
|
||||
import net.minecraft.util.Direction.Axis;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.util.math.vector.Vector3f;
|
||||
|
||||
public class CouplingRenderer {
|
||||
|
||||
public static void renderAll(PoseStack ms, MultiBufferSource buffer) {
|
||||
|
@ -149,8 +123,8 @@ public class CouplingRenderer {
|
|||
double yIn = lerp(pt, cart.yOld, cart.getY());
|
||||
double zIn = lerp(pt, cart.zOld, cart.getZ());
|
||||
|
||||
float yaw = lerp(pt, cart.yRotO, cart.yRot);
|
||||
float pitch = lerp(pt, cart.xRotO, cart.xRot);
|
||||
float yaw = lerp(pt, cart.yRotO, cart.getYRot());
|
||||
float pitch = lerp(pt, cart.xRotO, cart.getXRot());
|
||||
float roll = cart.getHurtTime() - pt;
|
||||
|
||||
float rollAmplifier = cart.getDamage() - pt;
|
||||
|
|
|
@ -87,7 +87,7 @@ public class MinecartCouplingItem extends Item {
|
|||
CouplingHandler.status(player, "removed");
|
||||
controller.decouple();
|
||||
if (!player.isCreative())
|
||||
player.inventory.placeItemBackInInventory(event.getWorld(),
|
||||
player.getInventory().placeItemBackInInventory(event.getWorld(),
|
||||
new ItemStack(AllItems.MINECART_COUPLING.get(), couplings));
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
package com.simibubi.create.content.contraptions.components.structureMovement.train;
|
||||
|
||||
import static net.minecraft.entity.Entity.getHorizontalDistanceSqr;
|
||||
import java.util.Map;
|
||||
|
||||
importimport com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.mojang.datafixers.util.Pair;
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.train.capability.CapabilityMinecartController;
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.train.capability.MinecartController;
|
||||
import com.simibubi.create.foundation.utility.VecHelper;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.Util;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
|
@ -19,25 +19,6 @@ import net.minecraft.world.level.block.BaseRailBlock;
|
|||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.state.properties.RailShape;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
|
||||
javanet.minecraft.world.entity.Entityogle.common.collect.Maps;
|
||||
import com.mojang.datafixers.util.Pair;
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.train.capability.CapabilityMinecartController;
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.train.capability.MinecartController;
|
||||
import com.simibubi.create.foundation.utility.VecHelper;
|
||||
|
||||
import net.minecraft.block.AbstractRailBlock;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.item.minecart.AbstractMinecartEntity;
|
||||
import net.minecraft.entity.item.minecart.FurnaceMinecartEntity;
|
||||
import net.minecraft.state.properties.RailShape;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Util;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.util.math.vector.Vector3i;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
|
||||
/**
|
||||
|
@ -179,7 +160,7 @@ public class MinecartSim2020 {
|
|||
if (Vector3d3 != null && actualVec != null) {
|
||||
double d17 = (actualVec.y - Vector3d3.y) * 0.05D;
|
||||
Vec3 Vector3d4 = cart.getDeltaMovement();
|
||||
double d18 = Math.sqrt(getHorizontalDistanceSqr(Vector3d4));
|
||||
double d18 = Math.sqrt(Vector3d4.horizontalDistanceSqr());
|
||||
if (d18 > 0.0D) {
|
||||
cart.setDeltaMovement(Vector3d4.multiply((d18 + d17) / d18, 1.0D, (d18 + d17) / d18));
|
||||
}
|
||||
|
@ -195,7 +176,7 @@ public class MinecartSim2020 {
|
|||
int i = Mth.floor(z);
|
||||
if (j != cartPos.getX() || i != cartPos.getZ()) {
|
||||
Vec3 Vector3d5 = cart.getDeltaMovement();
|
||||
double d26 = Math.sqrt(getHorizontalDistanceSqr(Vector3d5));
|
||||
double d26 = Math.sqrt(Vector3d5.horizontalDistanceSqr());
|
||||
cart.setDeltaMovement(d26 * (double) (j - cartPos.getX()), Vector3d5.y, d26 * (double) (i - cartPos.getZ()));
|
||||
}
|
||||
|
||||
|
|
|
@ -398,16 +398,16 @@ public class MinecartController implements INBTSerializable<CompoundTag> {
|
|||
StallData(AbstractMinecart entity) {
|
||||
position = entity.position();
|
||||
motion = entity.getDeltaMovement();
|
||||
yaw = entity.yRot;
|
||||
pitch = entity.xRot;
|
||||
yaw = entity.getYRot();
|
||||
pitch = entity.getXRot();
|
||||
tick(entity);
|
||||
}
|
||||
|
||||
void tick(AbstractMinecart entity) {
|
||||
entity.setPos(position.x, position.y, position.z);
|
||||
entity.setDeltaMovement(Vec3.ZERO);
|
||||
entity.yRot = yaw;
|
||||
entity.xRot = pitch;
|
||||
entity.setYRot(yaw);
|
||||
entity.setXRot(pitch);
|
||||
}
|
||||
|
||||
void release(AbstractMinecart entity) {
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
package com.simibubi.create.content.contraptions.components.tracks;
|
||||
|
||||
import static net.minecraft.state.properties.RailShape.NORTH_SOUTH;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
import javanet.minimport com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.content.contraptions.wrench.IWrenchable;
|
||||
import com.simibubi.create.foundation.utility.Iterate;
|
||||
import com.simibubi.create.foundation.utility.VecHelper;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
|
||||
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.Direction.Axis;
|
||||
|
@ -27,7 +27,6 @@ import net.minecraft.world.level.block.Block;
|
|||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.Mirror;
|
||||
import net.minecraft.world.level.block.Rotation;
|
||||
import net.minecraft.world.level.block.state.BlockBehaviour.Properties;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.state.StateDefinition;
|
||||
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
||||
|
@ -35,44 +34,9 @@ import net.minecraft.world.level.block.state.properties.BooleanProperty;
|
|||
import net.minecraft.world.level.block.state.properties.EnumProperty;
|
||||
import net.minecraft.world.level.block.state.properties.IntegerProperty;
|
||||
import net.minecraft.world.level.block.state.properties.Property;
|
||||
import net.minecraft.world.level.block.state.properties.RailShape;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
|
||||
ecraft.world.level.block.state.properties.RailShapeotation.ParametersAreNonnullByDefault;
|
||||
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.content.contraptions.wrench.IWrenchable;
|
||||
import com.simibubi.create.foundation.utility.Iterate;
|
||||
import com.simibubi.create.foundation.utility.VecHelper;
|
||||
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
import net.minecraft.block.AbstractRailBlock;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.entity.item.minecart.AbstractMinecartEntity;
|
||||
import net.minecraft.entity.item.minecart.FurnaceMinecartEntity;
|
||||
import net.minecraft.item.BlockItemUseContext;
|
||||
import net.minecraft.item.ItemUseContext;
|
||||
import net.minecraft.state.BooleanProperty;
|
||||
import net.minecraft.state.EnumProperty;
|
||||
import net.minecraft.state.IntegerProperty;
|
||||
import net.minecraft.state.Property;
|
||||
import net.minecraft.state.StateContainer;
|
||||
import net.minecraft.state.properties.BlockStateProperties;
|
||||
import net.minecraft.state.properties.RailShape;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Direction.Axis;
|
||||
import net.minecraft.util.Direction.AxisDirection;
|
||||
import net.minecraft.util.Mirror;
|
||||
import net.minecraft.util.Rotation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.util.math.vector.Vector3i;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
public class ControllerRailBlock extends BaseRailBlock implements IWrenchable {
|
||||
|
@ -86,7 +50,7 @@ public class ControllerRailBlock extends BaseRailBlock implements IWrenchable {
|
|||
this.registerDefaultState(this.stateDefinition.any()
|
||||
.setValue(POWER, 0)
|
||||
.setValue(BACKWARDS, false)
|
||||
.setValue(SHAPE, NORTH_SOUTH));
|
||||
.setValue(SHAPE, RailShape.NORTH_SOUTH));
|
||||
}
|
||||
|
||||
public static Vec3i getAccelerationVector(BlockState state) {
|
||||
|
|
|
@ -89,7 +89,7 @@ public class TurntableBlock extends KineticBlock implements ITE<TurntableTileEnt
|
|||
e.hurtMarked = true;
|
||||
}
|
||||
|
||||
e.yRot -= speed;
|
||||
e.setYRot(e.getYRot() - speed);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -39,8 +39,8 @@ public class TurntableHandler {
|
|||
if (offset.length() > 1/4f)
|
||||
speed *= Mth.clamp((1/2f - offset.length()) * 2, 0, 1);
|
||||
|
||||
mc.player.yRot = mc.player.yRotO - speed * AnimationTickHolder.getPartialTicks();
|
||||
mc.player.yBodyRot = mc.player.yRot;
|
||||
mc.player.setYRot(mc.player.yRotO - speed * AnimationTickHolder.getPartialTicks());
|
||||
mc.player.yBodyRot = mc.player.getYRot();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,12 +2,14 @@ package com.simibubi.create.content.contraptions.components.turntable;
|
|||
|
||||
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
||||
public class TurntableTileEntity extends KineticTileEntity {
|
||||
|
||||
public TurntableTileEntity(BlockEntityType<? extends TurntableTileEntity> type) {
|
||||
super(type);
|
||||
public TurntableTileEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
|
||||
super(type, pos, state);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ import com.simibubi.create.foundation.fluid.FluidHelper;
|
|||
import com.simibubi.create.foundation.utility.Iterate;
|
||||
import com.simibubi.create.foundation.utility.worldWrappers.WrappedWorld;
|
||||
|
||||
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.Direction.Axis;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue