Stonehedge

- Fixed Harvesters hard-colliding with leaves when used with pistons, pulleys or a gantry carriage
- Fixed kinetic tiles not marking chunks for saving when speed or stress changes
- Dedicated Servers no longer create a resourcepack folder
This commit is contained in:
simibubi 2021-12-28 13:04:22 +01:00
parent ffeecfdce0
commit 8e4dcb958d
8 changed files with 52 additions and 29 deletions

View file

@ -4,7 +4,7 @@ org.gradle.jvmargs = -Xmx3G
org.gradle.daemon = false
# mod version info
mod_version = 0.4a
mod_version = 0.4b
minecraft_version = 1.18.1
forge_version = 39.0.8

View file

@ -58,7 +58,7 @@ public class Create {
public static final String ID = "create";
public static final String NAME = "Create";
public static final String VERSION = "0.4a";
public static final String VERSION = "0.4b";
public static final Logger LOGGER = LogManager.getLogger();
@ -125,8 +125,6 @@ public class Create {
SchematicInstances.register();
BuiltinPotatoProjectileTypes.register();
ShippedResourcePacks.extractFiles("Copper Legacy Pack");
event.enqueueWork(() -> {
AllTriggers.register();
SchematicProcessor.register();

View file

@ -25,6 +25,7 @@ import com.simibubi.create.foundation.render.CachedBufferer;
import com.simibubi.create.foundation.render.CreateContexts;
import com.simibubi.create.foundation.render.SuperByteBufferCache;
import com.simibubi.create.foundation.utility.ModelSwapper;
import com.simibubi.create.foundation.utility.ShippedResourcePacks;
import com.simibubi.create.foundation.utility.ghost.GhostBlocks;
import com.simibubi.create.foundation.utility.outliner.Outliner;
@ -81,6 +82,8 @@ public class CreateClient {
BUFFER_CACHE.registerCompartment(SBBContraptionManager.CONTRAPTION, 20);
BUFFER_CACHE.registerCompartment(WorldSectionElement.DOC_WORLD_SECTION, 20);
ShippedResourcePacks.extractFiles("Copper Legacy Pack");
AllKeys.register();
// AllFluids.assignRenderLayers();
AllBlockPartials.init();

View file

@ -151,6 +151,7 @@ public class KineticTileEntity extends SmartTileEntity
this.stress = currentStress;
this.networkSize = networkSize;
boolean overStressed = maxStress < currentStress && StressImpact.isEnabled();
setChanged();
if (overStressed != this.overStressed) {
float prevSpeed = getSpeed();
@ -181,6 +182,7 @@ public class KineticTileEntity extends SmartTileEntity
boolean directionSwap = !fromOrToZero && Math.signum(previousSpeed) != Math.signum(getSpeed());
if (fromOrToZero || directionSwap)
flickerTally = getFlickerScore() + 5;
setChanged();
}
@Override
@ -324,6 +326,7 @@ public class KineticTileEntity extends SmartTileEntity
getOrCreateNetwork().remove(this);
network = networkIn;
setChanged();
if (networkIn == null)
return;

View file

@ -107,7 +107,7 @@ public class HarvesterMovementBehaviour extends MovementBehaviour {
world.setBlockAndUpdate(pos, cutCrop(world, pos, stateVisited));
}
private boolean isValidCrop(Level world, BlockPos pos, BlockState state) {
public boolean isValidCrop(Level world, BlockPos pos, BlockState state) {
boolean harvestPartial = AllConfigs.SERVER.kinetics.harvestPartiallyGrown.get();
boolean replant = AllConfigs.SERVER.kinetics.harvesterReplants.get();
@ -141,7 +141,7 @@ public class HarvesterMovementBehaviour extends MovementBehaviour {
return false;
}
private boolean isValidOther(Level world, BlockPos pos, BlockState state) {
public boolean isValidOther(Level world, BlockPos pos, BlockState state) {
if (state.getBlock() instanceof CropBlock)
return false;
if (state.getBlock() instanceof SugarCaneBlock)

View file

@ -8,6 +8,7 @@ import com.simibubi.create.AllTags.AllBlockTags;
import com.simibubi.create.Create;
import com.simibubi.create.content.contraptions.components.actors.AttachedActorBlock;
import com.simibubi.create.content.contraptions.components.actors.HarvesterBlock;
import com.simibubi.create.content.contraptions.components.actors.PloughBlock;
import com.simibubi.create.content.contraptions.components.actors.PortableStorageInterfaceBlock;
import com.simibubi.create.content.contraptions.components.crank.HandCrankBlock;
import com.simibubi.create.content.contraptions.components.fan.NozzleBlock;
@ -347,6 +348,11 @@ public class BlockMovementChecks {
return state.getValue(BlockStateProperties.FACING) == facing;
if (AllBlocks.MECHANICAL_BEARING.has(state))
return state.getValue(BlockStateProperties.FACING) == facing;
if (AllBlocks.MECHANICAL_HARVESTER.has(state))
return state.getValue(HarvesterBlock.FACING) == facing;
if (AllBlocks.MECHANICAL_PLOUGH.has(state))
return state.getValue(PloughBlock.FACING) == facing;
if (AllBlocks.CART_ASSEMBLER.has(state))
return Direction.DOWN == facing;
if (AllBlocks.MECHANICAL_SAW.has(state))

View file

@ -14,6 +14,7 @@ import com.google.common.base.Predicates;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllMovementBehaviours;
import com.simibubi.create.content.contraptions.components.actors.BlockBreakingMovementBehaviour;
import com.simibubi.create.content.contraptions.components.actors.HarvesterMovementBehaviour;
import com.simibubi.create.content.contraptions.components.structureMovement.AbstractContraptionEntity.ContraptionRotationState;
import com.simibubi.create.content.contraptions.components.structureMovement.sync.ClientMotionPacket;
import com.simibubi.create.foundation.collision.ContinuousOBBCollider.ContinuousSeparationManifold;
@ -242,10 +243,10 @@ public class ContraptionCollider {
boolean hasNormal = !collisionNormal.equals(Vec3.ZERO);
boolean anyCollision = hardCollision || temporalCollision;
if (bounce > 0 && hasNormal && anyCollision && bounceEntity(entity, collisionNormal, contraptionEntity, bounce)) {
entity.level.playSound(playerType == PlayerType.CLIENT ? (Player) entity : null,
entity.getX(), entity.getY(), entity.getZ(), SoundEvents.SLIME_BLOCK_FALL,
SoundSource.BLOCKS, .5f, 1);
if (bounce > 0 && hasNormal && anyCollision
&& bounceEntity(entity, collisionNormal, contraptionEntity, bounce)) {
entity.level.playSound(playerType == PlayerType.CLIENT ? (Player) entity : null, entity.getX(),
entity.getY(), entity.getZ(), SoundEvents.SLIME_BLOCK_FALL, SoundSource.BLOCKS, .5f, 1);
continue;
}
@ -339,25 +340,30 @@ public class ContraptionCollider {
return false;
Vec3 contactPointMotion = contraption.getContactPointMotion(entity.position());
Vec3 motion = entity.getDeltaMovement().subtract(contactPointMotion);
Vec3 deltav = normal.scale(factor*2*motion.dot(normal));
Vec3 motion = entity.getDeltaMovement()
.subtract(contactPointMotion);
Vec3 deltav = normal.scale(factor * 2 * motion.dot(normal));
if (deltav.dot(deltav) < 0.1f)
return false;
entity.setDeltaMovement(entity.getDeltaMovement().subtract(deltav));
return false;
entity.setDeltaMovement(entity.getDeltaMovement()
.subtract(deltav));
return true;
}
public static Vec3 getWorldToLocalTranslation(Entity entity, AbstractContraptionEntity contraptionEntity) {
return getWorldToLocalTranslation(entity, contraptionEntity.getAnchorVec(), contraptionEntity.getRotationState());
return getWorldToLocalTranslation(entity, contraptionEntity.getAnchorVec(),
contraptionEntity.getRotationState());
}
public static Vec3 getWorldToLocalTranslation(Entity entity, Vec3 anchorVec, ContraptionRotationState rotation) {
return getWorldToLocalTranslation(entity, anchorVec, rotation.asMatrix(), rotation.getYawOffset());
}
public static Vec3 getWorldToLocalTranslation(Entity entity, Vec3 anchorVec, Matrix3d rotationMatrix, float yawOffset) {
public static Vec3 getWorldToLocalTranslation(Entity entity, Vec3 anchorVec, Matrix3d rotationMatrix,
float yawOffset) {
Vec3 entityPosition = entity.position();
Vec3 centerY = new Vec3(0, entity.getBoundingBox().getYsize() / 2, 0);
Vec3 centerY = new Vec3(0, entity.getBoundingBox()
.getYsize() / 2, 0);
Vec3 position = entityPosition;
position = position.add(centerY);
position = position.subtract(VecHelper.CENTER_OF_ORIGIN);
@ -371,14 +377,16 @@ public class ContraptionCollider {
}
public static Vec3 getWorldToLocalTranslation(Vec3 entity, AbstractContraptionEntity contraptionEntity) {
return getWorldToLocalTranslation(entity, contraptionEntity.getAnchorVec(), contraptionEntity.getRotationState());
return getWorldToLocalTranslation(entity, contraptionEntity.getAnchorVec(),
contraptionEntity.getRotationState());
}
public static Vec3 getWorldToLocalTranslation(Vec3 inPos, Vec3 anchorVec, ContraptionRotationState rotation) {
return getWorldToLocalTranslation(inPos, anchorVec, rotation.asMatrix(), rotation.getYawOffset());
}
public static Vec3 getWorldToLocalTranslation(Vec3 inPos, Vec3 anchorVec, Matrix3d rotationMatrix, float yawOffset) {
public static Vec3 getWorldToLocalTranslation(Vec3 inPos, Vec3 anchorVec, Matrix3d rotationMatrix,
float yawOffset) {
Vec3 position = inPos;
position = position.subtract(VecHelper.CENTER_OF_ORIGIN);
position = position.subtract(anchorVec);
@ -436,8 +444,7 @@ public class ContraptionCollider {
return entity instanceof LocalPlayer;
}
private static List<VoxelShape> getPotentiallyCollidedShapes(Level world, Contraption contraption,
AABB localBB) {
private static List<VoxelShape> getPotentiallyCollidedShapes(Level world, Contraption contraption, AABB localBB) {
double height = localBB.getYsize();
double width = localBB.getXsize();
@ -536,16 +543,24 @@ public class ContraptionCollider {
BlockState collidedState = world.getBlockState(colliderPos);
StructureBlockInfo blockInfo = contraption.getBlocks()
.get(pos);
boolean emptyCollider = collidedState.getCollisionShape(world, pos)
.isEmpty();
if (AllMovementBehaviours.contains(blockInfo.state.getBlock())) {
MovementBehaviour movementBehaviour = AllMovementBehaviours.of(blockInfo.state.getBlock());
if (movementBehaviour instanceof BlockBreakingMovementBehaviour) {
BlockBreakingMovementBehaviour behaviour = (BlockBreakingMovementBehaviour) movementBehaviour;
if (!behaviour.canBreak(world, colliderPos, collidedState)
&& !collidedState.getCollisionShape(world, pos)
.isEmpty()) {
if (!behaviour.canBreak(world, colliderPos, collidedState) && !emptyCollider)
return true;
continue;
}
if (movementBehaviour instanceof HarvesterMovementBehaviour) {
HarvesterMovementBehaviour harvesterMovementBehaviour =
(HarvesterMovementBehaviour) movementBehaviour;
if (!harvesterMovementBehaviour.isValidCrop(world, colliderPos, collidedState)
&& !harvesterMovementBehaviour.isValidOther(world, colliderPos, collidedState)
&& !emptyCollider)
return true;
}
continue;
}
}
@ -556,9 +571,7 @@ public class ContraptionCollider {
if (collidedState.getBlock() instanceof CocoaBlock)
continue;
if (!collidedState.getMaterial()
.isReplaceable()
&& !collidedState.getCollisionShape(world, colliderPos)
.isEmpty()) {
.isReplaceable() && !emptyCollider) {
return true;
}

View file

@ -5,7 +5,7 @@ license="MIT"
[[mods]]
modId="create"
version="0.4a"
version="0.4b"
displayName="Create"
#updateJSONURL=""
displayURL="https://www.curseforge.com/minecraft/mc-mods/create"