mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-14 11:43:49 +01:00
Sundays' one-liners
- Fixed ploughs destroying track marker blocks - Fixed track markers spawning block particle effects - Safety check for PSI updates - Fixed sliding doors not having correct rendering boundaries - Fixed PSI overstretching their model - Fixed bogeys being ignored by schematicannons - Fixed downward facing deployers not aiming correctly on trains - Fixed incorrect relative motion provided to mounted actors by trains - Basins now attempt to dump existing output content into newly created auto-outputs - Builders Tea can now be scooped out of basins manually - Basins now prioritise output tanks when filling held items - Fixed pulley contraptions not receiving light updates below y=0
This commit is contained in:
parent
7199ebfb6b
commit
2eec01ad1c
10 changed files with 98 additions and 21 deletions
|
@ -3,6 +3,7 @@ package com.simibubi.create.content.contraptions.components.actors;
|
|||
import com.simibubi.create.content.contraptions.components.actors.PloughBlock.PloughFakePlayer;
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext;
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.OrientedContraptionEntity;
|
||||
import com.simibubi.create.content.logistics.trains.track.FakeTrackBlock;
|
||||
import com.simibubi.create.foundation.utility.VecHelper;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
|
@ -84,6 +85,8 @@ public class PloughMovementBehaviour extends BlockBreakingMovementBehaviour {
|
|||
return false;
|
||||
if (state.getBlock() instanceof NetherPortalBlock)
|
||||
return false;
|
||||
if (state.getBlock() instanceof FakeTrackBlock)
|
||||
return false;
|
||||
return state.getCollisionShape(world, breakingPos)
|
||||
.isEmpty();
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ public abstract class PortableStorageInterfaceTileEntity extends SmartTileEntity
|
|||
}
|
||||
|
||||
public void startTransferringTo(Contraption contraption, float distance) {
|
||||
this.distance = distance;
|
||||
this.distance = Math.min(2, distance);
|
||||
connectedEntity = contraption.entity;
|
||||
startConnecting();
|
||||
notifyUpdate();
|
||||
|
|
|
@ -21,6 +21,7 @@ import com.simibubi.create.content.contraptions.components.structureMovement.Ori
|
|||
import com.simibubi.create.content.contraptions.components.structureMovement.render.ActorInstance;
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionMatrices;
|
||||
import com.simibubi.create.content.logistics.item.filter.FilterItem;
|
||||
import com.simibubi.create.content.logistics.trains.entity.CarriageContraptionEntity;
|
||||
import com.simibubi.create.content.schematics.ItemRequirement;
|
||||
import com.simibubi.create.content.schematics.SchematicWorld;
|
||||
import com.simibubi.create.content.schematics.filtering.SchematicInstances;
|
||||
|
@ -92,6 +93,8 @@ public class DeployerMovementBehaviour implements MovementBehaviour {
|
|||
Vec3 initial = new Vec3(0, 0, 1);
|
||||
if (context.contraption.entity instanceof OrientedContraptionEntity oce)
|
||||
initial = VecHelper.rotate(initial, oce.getInitialYaw(), Axis.Y);
|
||||
if (context.contraption.entity instanceof CarriageContraptionEntity cce)
|
||||
initial = VecHelper.rotate(initial, 90, Axis.Y);
|
||||
facingVec = context.rotation.apply(initial);
|
||||
}
|
||||
|
||||
|
|
|
@ -432,7 +432,8 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit
|
|||
StructureBlockInfo blockInfo = pair.left;
|
||||
MovementBehaviour actor = AllMovementBehaviours.of(blockInfo.state);
|
||||
if (actor instanceof PortableStorageInterfaceMovement && isActorActive(context, actor))
|
||||
actor.visitNewPosition(context, new BlockPos(context.position));
|
||||
if (context.position != null)
|
||||
actor.visitNewPosition(context, new BlockPos(context.position));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -452,17 +453,19 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit
|
|||
return false;
|
||||
|
||||
context.motion = actorPosition.subtract(previousPosition);
|
||||
|
||||
if (!level.isClientSide() && context.contraption.entity instanceof CarriageContraptionEntity cce
|
||||
&& cce.getCarriage() != null) {
|
||||
Train train = cce.getCarriage().train;
|
||||
double actualSpeed = train.speedBeforeStall != null ? train.speedBeforeStall : train.speed;
|
||||
context.motion = context.motion.normalize()
|
||||
.scale(actualSpeed);
|
||||
.scale(Math.abs(actualSpeed));
|
||||
}
|
||||
|
||||
Vec3 relativeMotion = context.motion;
|
||||
relativeMotion = reverseRotation(relativeMotion, 1);
|
||||
context.relativeMotion = relativeMotion;
|
||||
|
||||
return !new BlockPos(previousPosition).equals(gridPosition)
|
||||
|| (context.relativeMotion.length() > 0 || context.contraption instanceof CarriageContraption)
|
||||
&& context.firstMovement;
|
||||
|
|
|
@ -20,13 +20,11 @@ public class PulleyLighter extends ContraptionLighter<PulleyContraption> {
|
|||
Level world = contraption.entity.level;
|
||||
|
||||
BlockPos.MutableBlockPos pos = contraption.anchor.mutable();
|
||||
while (!AllBlocks.ROPE_PULLEY.has(world.getBlockState(pos)) && pos.getY() < 256) {
|
||||
while (!AllBlocks.ROPE_PULLEY.has(world.getBlockState(pos)) && pos.getY() < world.getMaxBuildHeight())
|
||||
pos.move(0, 1, 0);
|
||||
}
|
||||
|
||||
bounds.translate(pos);
|
||||
bounds.setMinY(1); // the super constructor will take care of making this 0
|
||||
|
||||
bounds.setMinY(world.getMinBuildHeight());
|
||||
return bounds;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.simibubi.create.content.contraptions.fluids.actors;
|
||||
|
||||
import com.simibubi.create.AllFluids;
|
||||
import com.simibubi.create.AllItems;
|
||||
import com.simibubi.create.content.contraptions.fluids.potion.PotionFluidHandler;
|
||||
import com.simibubi.create.foundation.fluid.FluidHelper;
|
||||
|
||||
|
@ -12,6 +13,7 @@ import net.minecraft.world.item.MilkBucketItem;
|
|||
import net.minecraft.world.item.alchemy.PotionUtils;
|
||||
import net.minecraft.world.item.alchemy.Potions;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.material.Fluid;
|
||||
import net.minecraft.world.level.material.Fluids;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
@ -97,10 +99,14 @@ public class GenericItemFilling {
|
|||
}
|
||||
|
||||
private static boolean canFillGlassBottleInternally(FluidStack availableFluid) {
|
||||
return availableFluid.getFluid()
|
||||
.isSame(Fluids.WATER)
|
||||
|| availableFluid.getFluid()
|
||||
.isSame(AllFluids.POTION.get());
|
||||
Fluid fluid = availableFluid.getFluid();
|
||||
if (fluid.isSame(Fluids.WATER))
|
||||
return true;
|
||||
if (fluid.isSame(AllFluids.POTION.get()))
|
||||
return true;
|
||||
if (fluid.isSame(AllFluids.TEA.get()))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
private static boolean canFillBucketInternally(FluidStack availableFluid) {
|
||||
|
@ -114,14 +120,17 @@ public class GenericItemFilling {
|
|||
|
||||
if (stack.getItem() == Items.GLASS_BOTTLE && canFillGlassBottleInternally(toFill)) {
|
||||
ItemStack fillBottle = ItemStack.EMPTY;
|
||||
if (FluidHelper.isWater(toFill.getFluid()))
|
||||
Fluid fluid = toFill.getFluid();
|
||||
if (FluidHelper.isWater(fluid))
|
||||
fillBottle = PotionUtils.setPotion(new ItemStack(Items.POTION), Potions.WATER);
|
||||
else if (fluid.isSame(AllFluids.TEA.get()))
|
||||
fillBottle = AllItems.BUILDERS_TEA.asStack();
|
||||
else
|
||||
fillBottle = PotionFluidHandler.fillBottle(stack, toFill);
|
||||
stack.shrink(1);
|
||||
return fillBottle;
|
||||
}
|
||||
|
||||
|
||||
ItemStack split = stack.copy();
|
||||
split.setCount(1);
|
||||
LazyOptional<IFluidHandlerItem> capability =
|
||||
|
|
|
@ -9,6 +9,7 @@ import java.util.Random;
|
|||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.simibubi.create.AllParticleTypes;
|
||||
import com.simibubi.create.AllTags;
|
||||
import com.simibubi.create.content.contraptions.components.mixer.MechanicalMixerTileEntity;
|
||||
|
@ -135,7 +136,7 @@ public class BasinTileEntity extends SmartTileEntity implements IHaveGoggleInfor
|
|||
fluidCapability = LazyOptional.of(() -> {
|
||||
LazyOptional<? extends IFluidHandler> inputCap = inputTank.getCapability();
|
||||
LazyOptional<? extends IFluidHandler> outputCap = outputTank.getCapability();
|
||||
return new CombinedTankWrapper(inputCap.orElse(null), outputCap.orElse(null));
|
||||
return new CombinedTankWrapper(outputCap.orElse(null), inputCap.orElse(null));
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -275,8 +276,39 @@ public class BasinTileEntity extends SmartTileEntity implements IHaveGoggleInfor
|
|||
&& preferredSpoutput != Direction.UP)
|
||||
newFacing = preferredSpoutput;
|
||||
|
||||
if (newFacing != currentFacing)
|
||||
level.setBlockAndUpdate(worldPosition, blockState.setValue(BasinBlock.FACING, newFacing));
|
||||
if (newFacing == currentFacing)
|
||||
return;
|
||||
|
||||
level.setBlockAndUpdate(worldPosition, blockState.setValue(BasinBlock.FACING, newFacing));
|
||||
|
||||
if (newFacing.getAxis()
|
||||
.isVertical())
|
||||
return;
|
||||
|
||||
for (int slot = 0; slot < outputInventory.getSlots(); slot++) {
|
||||
ItemStack extractItem = outputInventory.extractItem(slot, 64, true);
|
||||
if (extractItem.isEmpty())
|
||||
continue;
|
||||
if (acceptOutputs(ImmutableList.of(extractItem), Collections.emptyList(), true))
|
||||
acceptOutputs(ImmutableList.of(outputInventory.extractItem(slot, 64, false)), Collections.emptyList(),
|
||||
false);
|
||||
}
|
||||
|
||||
IFluidHandler handler = outputTank.getCapability()
|
||||
.orElse(null);
|
||||
for (int slot = 0; slot < handler.getTanks(); slot++) {
|
||||
FluidStack fs = handler.getFluidInTank(slot)
|
||||
.copy();
|
||||
if (fs.isEmpty())
|
||||
continue;
|
||||
if (acceptOutputs(Collections.emptyList(), ImmutableList.of(fs), true)) {
|
||||
handler.drain(fs, FluidAction.EXECUTE);
|
||||
acceptOutputs(Collections.emptyList(), ImmutableList.of(fs), false);
|
||||
}
|
||||
}
|
||||
|
||||
notifyChangeOfContents();
|
||||
notifyUpdate();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -664,8 +696,8 @@ public class BasinTileEntity extends SmartTileEntity implements IHaveGoggleInfor
|
|||
float angle = interval * (1 + currentSegment) + intervalOffset;
|
||||
Vec3 vec = centerOf.add(VecHelper.rotate(pointer, angle, Axis.Y));
|
||||
level.addAlwaysVisibleParticle(
|
||||
new FluidParticleData(AllParticleTypes.BASIN_FLUID.get(), tankSegment.getRenderedFluid()),
|
||||
vec.x(), surface, vec.z(), 1, 0, 0);
|
||||
new FluidParticleData(AllParticleTypes.BASIN_FLUID.get(), tankSegment.getRenderedFluid()), vec.x(),
|
||||
surface, vec.z(), 1, 0, 0);
|
||||
currentSegment++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ import net.minecraft.world.level.block.Blocks;
|
|||
import net.minecraft.world.level.block.DoorBlock;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
|
||||
public class SlidingDoorTileEntity extends SmartTileEntity {
|
||||
|
||||
|
@ -53,6 +54,11 @@ public class SlidingDoorTileEntity extends SmartTileEntity {
|
|||
showBlockModel();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AABB createRenderBoundingBox() {
|
||||
return super.createRenderBoundingBox().inflate(1);
|
||||
}
|
||||
|
||||
protected boolean isVisible(BlockState state) {
|
||||
return state.getOptionalValue(TrainDoorBlock.VISIBLE)
|
||||
.orElse(true);
|
||||
|
|
|
@ -8,8 +8,11 @@ import com.simibubi.create.foundation.block.ProperWaterloggedBlock;
|
|||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.item.context.BlockPlaceContext;
|
||||
import net.minecraft.world.level.BlockGetter;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.LevelAccessor;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.EntityBlock;
|
||||
|
@ -78,5 +81,16 @@ public class FakeTrackBlock extends Block implements EntityBlock, ProperWaterlog
|
|||
public BlockEntity newBlockEntity(BlockPos pPos, BlockState pState) {
|
||||
return AllTileEntities.FAKE_TRACK.create(pPos, pState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addLandingEffects(BlockState state1, ServerLevel level, BlockPos pos, BlockState state2,
|
||||
LivingEntity entity, int numberOfParticles) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addRunningEffects(BlockState state, Level level, BlockPos pos, Entity entity) {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -13,6 +13,9 @@ import com.simibubi.create.content.contraptions.relays.elementary.ShaftBlock;
|
|||
import com.simibubi.create.content.logistics.trains.IBogeyBlock;
|
||||
import com.simibubi.create.content.logistics.trains.entity.BogeyInstance;
|
||||
import com.simibubi.create.content.logistics.trains.entity.CarriageBogey;
|
||||
import com.simibubi.create.content.schematics.ISpecialBlockItemRequirement;
|
||||
import com.simibubi.create.content.schematics.ItemRequirement;
|
||||
import com.simibubi.create.content.schematics.ItemRequirement.ItemUseType;
|
||||
import com.simibubi.create.foundation.block.ITE;
|
||||
import com.simibubi.create.foundation.block.ProperWaterloggedBlock;
|
||||
import com.simibubi.create.foundation.render.CachedBufferer;
|
||||
|
@ -31,6 +34,7 @@ import net.minecraft.world.level.LevelAccessor;
|
|||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.Rotation;
|
||||
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.StateDefinition.Builder;
|
||||
|
@ -43,7 +47,7 @@ import net.minecraftforge.api.distmarker.Dist;
|
|||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
public class StandardBogeyBlock extends Block
|
||||
implements IBogeyBlock, ITE<StandardBogeyTileEntity>, ProperWaterloggedBlock {
|
||||
implements IBogeyBlock, ITE<StandardBogeyTileEntity>, ProperWaterloggedBlock, ISpecialBlockItemRequirement {
|
||||
|
||||
public static final EnumProperty<Axis> AXIS = BlockStateProperties.HORIZONTAL_AXIS;
|
||||
private final boolean large;
|
||||
|
@ -74,12 +78,12 @@ public class StandardBogeyBlock extends Block
|
|||
updateWater(pLevel, pState, pCurrentPos);
|
||||
return pState;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public FluidState getFluidState(BlockState pState) {
|
||||
return fluidState(pState);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public double getWheelPointSpacing() {
|
||||
return 2;
|
||||
|
@ -228,4 +232,9 @@ public class StandardBogeyBlock extends Block
|
|||
return AllTileEntities.BOGEY.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemRequirement getRequiredItems(BlockState state, BlockEntity te) {
|
||||
return new ItemRequirement(ItemUseType.CONSUME, AllBlocks.RAILWAY_CASING.asStack());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue