mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-16 09:03:41 +01:00
Riding the engine
- Fixed incompatibility between seats and furnace cart contraptions
This commit is contained in:
parent
80406e8782
commit
f0abbaacd7
14 changed files with 36 additions and 18 deletions
|
@ -2,7 +2,7 @@ import org.apache.commons.lang3.mutable.MutableObject;
|
||||||
|
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.Contraption;
|
import com.simibubi.create.content.contraptions.components.structureMovement.Contraption;
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.ContraptionEntity;
|
import com.simibubi.create.content.contraptions.components.structureMovement.ContraptionEntity;
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.ContraptionInteractionPacket;
|
import com.simibubi.create.content.contraptions.components.structureMovement.sync.ContraptionInteractionPacket;
|
||||||
import com.simibubi.create.foundation.networking.AllPackets;
|
import com.simibubi.create.foundation.networking.AllPackets;
|
||||||
import com.simibubi.create.foundation.utility.RaycastHelper;
|
import com.simibubi.create.foundation.utility.RaycastHelper;
|
||||||
import com.simibubi.create.foundation.utility.RaycastHelper.PredicateTraceResult;
|
import com.simibubi.create.foundation.utility.RaycastHelper.PredicateTraceResult;
|
||||||
|
|
|
@ -89,7 +89,6 @@ public class Create {
|
||||||
if (schematicReceiver == null)
|
if (schematicReceiver == null)
|
||||||
schematicReceiver = new ServerSchematicLoader();
|
schematicReceiver = new ServerSchematicLoader();
|
||||||
schematicReceiver.tick();
|
schematicReceiver.tick();
|
||||||
|
|
||||||
lagger.tick();
|
lagger.tick();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,8 @@ import java.util.function.Function;
|
||||||
|
|
||||||
import com.simibubi.create.content.contraptions.KineticDebugger;
|
import com.simibubi.create.content.contraptions.KineticDebugger;
|
||||||
import com.simibubi.create.content.contraptions.base.KineticTileEntityRenderer;
|
import com.simibubi.create.content.contraptions.base.KineticTileEntityRenderer;
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.ChassisRangeDisplay;
|
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.ContraptionRenderer;
|
import com.simibubi.create.content.contraptions.components.structureMovement.ContraptionRenderer;
|
||||||
|
import com.simibubi.create.content.contraptions.components.structureMovement.chassis.ChassisRangeDisplay;
|
||||||
import com.simibubi.create.content.contraptions.relays.belt.item.BeltConnectorHandler;
|
import com.simibubi.create.content.contraptions.relays.belt.item.BeltConnectorHandler;
|
||||||
import com.simibubi.create.content.curiosities.tools.ExtendoGripRenderHandler;
|
import com.simibubi.create.content.curiosities.tools.ExtendoGripRenderHandler;
|
||||||
import com.simibubi.create.content.curiosities.zapper.ZapperRenderHandler;
|
import com.simibubi.create.content.curiosities.zapper.ZapperRenderHandler;
|
||||||
|
|
|
@ -812,6 +812,10 @@ public abstract class Contraption {
|
||||||
return seatMapping;
|
return seatMapping;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setSeatMapping(Map<UUID, Integer> seatMapping) {
|
||||||
|
this.seatMapping = seatMapping;
|
||||||
|
}
|
||||||
|
|
||||||
public List<BlockPos> getSeats() {
|
public List<BlockPos> getSeats() {
|
||||||
return seats;
|
return seats;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@ import com.google.common.cache.CacheBuilder;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
import com.simibubi.create.AllBlocks;
|
import com.simibubi.create.AllBlocks;
|
||||||
import com.simibubi.create.content.contraptions.components.actors.BlockBreakingMovementBehaviour;
|
import com.simibubi.create.content.contraptions.components.actors.BlockBreakingMovementBehaviour;
|
||||||
|
import com.simibubi.create.content.contraptions.components.structureMovement.sync.ClientMotionPacket;
|
||||||
import com.simibubi.create.foundation.collision.ContinuousOBBCollider.ContinuousSeparationManifold;
|
import com.simibubi.create.foundation.collision.ContinuousOBBCollider.ContinuousSeparationManifold;
|
||||||
import com.simibubi.create.foundation.collision.Matrix3d;
|
import com.simibubi.create.foundation.collision.Matrix3d;
|
||||||
import com.simibubi.create.foundation.collision.OrientedBB;
|
import com.simibubi.create.foundation.collision.OrientedBB;
|
||||||
|
|
|
@ -16,6 +16,7 @@ import com.simibubi.create.content.contraptions.components.structureMovement.bea
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.glue.SuperGlueEntity;
|
import com.simibubi.create.content.contraptions.components.structureMovement.glue.SuperGlueEntity;
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.mounted.CartAssemblerTileEntity.CartMovementMode;
|
import com.simibubi.create.content.contraptions.components.structureMovement.mounted.CartAssemblerTileEntity.CartMovementMode;
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.mounted.MountedContraption;
|
import com.simibubi.create.content.contraptions.components.structureMovement.mounted.MountedContraption;
|
||||||
|
import com.simibubi.create.content.contraptions.components.structureMovement.sync.ContraptionSeatMappingPacket;
|
||||||
import com.simibubi.create.foundation.item.ItemHelper;
|
import com.simibubi.create.foundation.item.ItemHelper;
|
||||||
import com.simibubi.create.foundation.networking.AllPackets;
|
import com.simibubi.create.foundation.networking.AllPackets;
|
||||||
import com.simibubi.create.foundation.utility.AngleHelper;
|
import com.simibubi.create.foundation.utility.AngleHelper;
|
||||||
|
@ -69,6 +70,7 @@ public class ContraptionEntity extends Entity implements IEntityAdditionalSpawnD
|
||||||
protected boolean stationary;
|
protected boolean stationary;
|
||||||
protected boolean initialized;
|
protected boolean initialized;
|
||||||
final List<Entity> collidingEntities = new ArrayList<>();
|
final List<Entity> collidingEntities = new ArrayList<>();
|
||||||
|
private boolean isSerializingFurnaceCart;
|
||||||
|
|
||||||
private static final Ingredient FUEL_ITEMS = Ingredient.fromItems(Items.COAL, Items.CHARCOAL);
|
private static final Ingredient FUEL_ITEMS = Ingredient.fromItems(Items.COAL, Items.CHARCOAL);
|
||||||
private static final DataParameter<Boolean> STALLED =
|
private static final DataParameter<Boolean> STALLED =
|
||||||
|
@ -90,6 +92,7 @@ public class ContraptionEntity extends Entity implements IEntityAdditionalSpawnD
|
||||||
super(entityTypeIn, worldIn);
|
super(entityTypeIn, worldIn);
|
||||||
motionBeforeStall = Vec3d.ZERO;
|
motionBeforeStall = Vec3d.ZERO;
|
||||||
stationary = entityTypeIn == AllEntityTypes.STATIONARY_CONTRAPTION.get();
|
stationary = entityTypeIn == AllEntityTypes.STATIONARY_CONTRAPTION.get();
|
||||||
|
isSerializingFurnaceCart = false;
|
||||||
forcedAngle = -1;
|
forcedAngle = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -352,7 +355,12 @@ public class ContraptionEntity extends Entity implements IEntityAdditionalSpawnD
|
||||||
|
|
||||||
if (!isStalled() && (riding instanceof FurnaceMinecartEntity)) {
|
if (!isStalled() && (riding instanceof FurnaceMinecartEntity)) {
|
||||||
FurnaceMinecartEntity furnaceCart = (FurnaceMinecartEntity) riding;
|
FurnaceMinecartEntity furnaceCart = (FurnaceMinecartEntity) riding;
|
||||||
|
|
||||||
|
// Notify to not trigger serialization side-effects
|
||||||
|
isSerializingFurnaceCart = true;
|
||||||
CompoundNBT nbt = furnaceCart.serializeNBT();
|
CompoundNBT nbt = furnaceCart.serializeNBT();
|
||||||
|
isSerializingFurnaceCart = false;
|
||||||
|
|
||||||
int fuel = nbt.getInt("Fuel");
|
int fuel = nbt.getInt("Fuel");
|
||||||
int fuelBefore = fuel;
|
int fuelBefore = fuel;
|
||||||
double pushX = nbt.getDouble("PushX");
|
double pushX = nbt.getDouble("PushX");
|
||||||
|
@ -672,6 +680,9 @@ public class ContraptionEntity extends Entity implements IEntityAdditionalSpawnD
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
@Override
|
@Override
|
||||||
public CompoundNBT writeWithoutTypeId(CompoundNBT nbt) {
|
public CompoundNBT writeWithoutTypeId(CompoundNBT nbt) {
|
||||||
|
if (isSerializingFurnaceCart)
|
||||||
|
return nbt;
|
||||||
|
|
||||||
Vec3d vec = getPositionVec();
|
Vec3d vec = getPositionVec();
|
||||||
List<Entity> passengers = getPassengers();
|
List<Entity> passengers = getPassengers();
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package com.simibubi.create.content.contraptions.components.structureMovement;
|
package com.simibubi.create.content.contraptions.components.structureMovement.chassis;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
@ -14,7 +14,6 @@ import com.simibubi.create.AllItems;
|
||||||
import com.simibubi.create.AllKeys;
|
import com.simibubi.create.AllKeys;
|
||||||
import com.simibubi.create.AllSpecialTextures;
|
import com.simibubi.create.AllSpecialTextures;
|
||||||
import com.simibubi.create.CreateClient;
|
import com.simibubi.create.CreateClient;
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.chassis.ChassisTileEntity;
|
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
|
@ -11,7 +11,6 @@ import java.util.Set;
|
||||||
|
|
||||||
import com.simibubi.create.AllBlocks;
|
import com.simibubi.create.AllBlocks;
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.BlockMovementTraits;
|
import com.simibubi.create.content.contraptions.components.structureMovement.BlockMovementTraits;
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.ChassisRangeDisplay;
|
|
||||||
import com.simibubi.create.foundation.config.AllConfigs;
|
import com.simibubi.create.foundation.config.AllConfigs;
|
||||||
import com.simibubi.create.foundation.tileEntity.SmartTileEntity;
|
import com.simibubi.create.foundation.tileEntity.SmartTileEntity;
|
||||||
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
|
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package com.simibubi.create.content.contraptions.components.structureMovement;
|
package com.simibubi.create.content.contraptions.components.structureMovement.sync;
|
||||||
|
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
package com.simibubi.create.content.contraptions.components.structureMovement;
|
package com.simibubi.create.content.contraptions.components.structureMovement.sync;
|
||||||
|
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
|
import com.simibubi.create.content.contraptions.components.structureMovement.ContraptionEntity;
|
||||||
import com.simibubi.create.foundation.networking.SimplePacketBase;
|
import com.simibubi.create.foundation.networking.SimplePacketBase;
|
||||||
|
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
|
@ -1,10 +1,11 @@
|
||||||
package com.simibubi.create.content.contraptions.components.structureMovement;
|
package com.simibubi.create.content.contraptions.components.structureMovement.sync;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
|
import com.simibubi.create.content.contraptions.components.structureMovement.ContraptionEntity;
|
||||||
import com.simibubi.create.foundation.networking.SimplePacketBase;
|
import com.simibubi.create.foundation.networking.SimplePacketBase;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
@ -44,12 +45,12 @@ public class ContraptionSeatMappingPacket extends SimplePacketBase {
|
||||||
public void handle(Supplier<Context> context) {
|
public void handle(Supplier<Context> context) {
|
||||||
context.get()
|
context.get()
|
||||||
.enqueueWork(() -> {
|
.enqueueWork(() -> {
|
||||||
Entity entityByID = Minecraft.getInstance().world
|
Entity entityByID = Minecraft.getInstance().world.getEntityByID(entityID);
|
||||||
.getEntityByID(entityID);
|
|
||||||
if (!(entityByID instanceof ContraptionEntity))
|
if (!(entityByID instanceof ContraptionEntity))
|
||||||
return;
|
return;
|
||||||
ContraptionEntity contraptionEntity = (ContraptionEntity) entityByID;
|
ContraptionEntity contraptionEntity = (ContraptionEntity) entityByID;
|
||||||
contraptionEntity.contraption.seatMapping = mapping;
|
contraptionEntity.getContraption()
|
||||||
|
.setSeatMapping(mapping);
|
||||||
});
|
});
|
||||||
context.get()
|
context.get()
|
||||||
.setPacketHandled(true);
|
.setPacketHandled(true);
|
|
@ -1,9 +1,11 @@
|
||||||
package com.simibubi.create;
|
package com.simibubi.create.events;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
|
import com.simibubi.create.Create;
|
||||||
|
import com.simibubi.create.CreateClient;
|
||||||
import com.simibubi.create.content.contraptions.KineticDebugger;
|
import com.simibubi.create.content.contraptions.KineticDebugger;
|
||||||
import com.simibubi.create.content.contraptions.base.KineticTileEntityRenderer;
|
import com.simibubi.create.content.contraptions.base.KineticTileEntityRenderer;
|
||||||
import com.simibubi.create.content.contraptions.components.turntable.TurntableHandler;
|
import com.simibubi.create.content.contraptions.components.turntable.TurntableHandler;
|
|
@ -1,5 +1,7 @@
|
||||||
package com.simibubi.create;
|
package com.simibubi.create.events;
|
||||||
|
|
||||||
|
import com.simibubi.create.Create;
|
||||||
|
import com.simibubi.create.CreateClient;
|
||||||
import com.simibubi.create.foundation.command.CreateCommand;
|
import com.simibubi.create.foundation.command.CreateCommand;
|
||||||
|
|
||||||
import net.minecraft.world.IWorld;
|
import net.minecraft.world.IWorld;
|
||||||
|
@ -20,7 +22,6 @@ public class CommonEvents {
|
||||||
public static void onTick(ServerTickEvent event) {
|
public static void onTick(ServerTickEvent event) {
|
||||||
if (event.phase == Phase.END)
|
if (event.phase == Phase.END)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Create.tick();
|
Create.tick();
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,11 +5,11 @@ import java.util.function.Function;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
import com.simibubi.create.Create;
|
import com.simibubi.create.Create;
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.ClientMotionPacket;
|
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.ContraptionInteractionPacket;
|
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.ContraptionSeatMappingPacket;
|
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.ContraptionStallPacket;
|
import com.simibubi.create.content.contraptions.components.structureMovement.ContraptionStallPacket;
|
||||||
import com.simibubi.create.content.contraptions.components.structureMovement.glue.GlueEffectPacket;
|
import com.simibubi.create.content.contraptions.components.structureMovement.glue.GlueEffectPacket;
|
||||||
|
import com.simibubi.create.content.contraptions.components.structureMovement.sync.ClientMotionPacket;
|
||||||
|
import com.simibubi.create.content.contraptions.components.structureMovement.sync.ContraptionInteractionPacket;
|
||||||
|
import com.simibubi.create.content.contraptions.components.structureMovement.sync.ContraptionSeatMappingPacket;
|
||||||
import com.simibubi.create.content.contraptions.relays.advanced.sequencer.ConfigureSequencedGearshiftPacket;
|
import com.simibubi.create.content.contraptions.relays.advanced.sequencer.ConfigureSequencedGearshiftPacket;
|
||||||
import com.simibubi.create.content.curiosities.symmetry.SymmetryEffectPacket;
|
import com.simibubi.create.content.curiosities.symmetry.SymmetryEffectPacket;
|
||||||
import com.simibubi.create.content.curiosities.tools.ExtendoGripInteractionPacket;
|
import com.simibubi.create.content.curiosities.tools.ExtendoGripInteractionPacket;
|
||||||
|
|
Loading…
Reference in a new issue