starting on vehicle physics

This commit is contained in:
Halbear
2026-05-28 22:40:11 +01:00
parent 68e923e644
commit 2a6e272dff
10 changed files with 94 additions and 21 deletions
@@ -10,11 +10,10 @@ public class VehicleAnimationManager<T extends VehicleBaseEntity> {
public static float DegToRad = (float)Math.PI/180.0F; public static float DegToRad = (float)Math.PI/180.0F;
public ModelRenderer PropellerAnimation(ModelRenderer BoneIn, T entity, AnimationAxis axis, boolean invertAnimation){ public ModelRenderer PropellerAnimation(ModelRenderer BoneIn, T entity, AnimationAxis axis, boolean invertAnimation){
float PartialTick = entity.GetPartialTick(); float PartialTick = VehicleBaseRenderer.PartialTick;
float TargetPropRotation = entity.GetFloatDataValue("TARGET_PROPELLER_ROTATION");
float CurrentPropRotation = entity.GetFloatDataValue("PROPELLER_ROTATION"); float CurrentPropRotation = entity.GetFloatDataValue("PROPELLER_ROTATION");
float Addition = (TargetPropRotation - CurrentPropRotation) * PartialTick; float Addition = CurrentPropRotation + (entity.GetFloatDataValue("PROPELLER_ROTATION_SPEED") * PartialTick);
float CurrentPropRotationRadians = ((CurrentPropRotation + Addition)% 36000) * (invertAnimation ? -DegToRad : DegToRad); float CurrentPropRotationRadians = (CurrentPropRotation + Addition) * (invertAnimation ? -DegToRad : DegToRad);
switch(axis){ switch(axis){
case X_AXIS: case X_AXIS:
BoneIn.rotateAngleX = CurrentPropRotationRadians; BoneIn.rotateAngleX = CurrentPropRotationRadians;
@@ -24,7 +24,7 @@ public class VehicleBaseRenderer<T extends VehicleBaseEntity, M extends EntityMo
private Vector3f LastRotations = new Vector3f(0,0,0); private Vector3f LastRotations = new Vector3f(0,0,0);
private PivotOrigin OriginType = PivotOrigin.RelativeToEntityCenter; private PivotOrigin OriginType = PivotOrigin.RelativeToEntityCenter;
private Vector3d OriginOffset = new Vector3d(0,0,0); private Vector3d OriginOffset = new Vector3d(0,0,0);
public static float PartialTick = 0.0f;
private final Map<String, M[]> STATE_BASED_MODELS = new HashMap<>(); private final Map<String, M[]> STATE_BASED_MODELS = new HashMap<>();
private String RenderState = "DEFAULT"; private String RenderState = "DEFAULT";
@@ -77,12 +77,15 @@ public class VehicleBaseRenderer<T extends VehicleBaseEntity, M extends EntityMo
@Override @Override
public void render(T entity, float entityYaw, float partialTicks, MatrixStack matrixStack, IRenderTypeBuffer buffer, int packedLight) { public void render(T entity, float entityYaw, float partialTicks, MatrixStack matrixStack, IRenderTypeBuffer buffer, int packedLight) {
PartialTick = partialTicks;
RenderState = entity.GetRenderState(); RenderState = entity.GetRenderState();
if(!STATE_BASED_MODELS.containsKey(RenderState)) RenderState = "DEFAULT"; if(!STATE_BASED_MODELS.containsKey(RenderState)) RenderState = "DEFAULT";
matrixStack.push(); matrixStack.push();
EventBeforeRender(entity, entityYaw, partialTicks, matrixStack, buffer, packedLight); EventBeforeRender(entity, entityYaw, partialTicks, matrixStack, buffer, packedLight);
Vector3d OriginPosition = new Vector3d(0,0,0).add(OriginOffset); Vector3d OriginPosition = new Vector3d(0,0,0).add(OriginOffset);
Vector3f RotationsToAdd = new Vector3f(entity.GetFloatDataValue("ADD_ORIENTATION_YAW_NEXT_TICK") * partialTicks,entity.GetFloatDataValue("ADD_ORIENTATION_PITCH_NEXT_TICK") * partialTicks,entity.GetFloatDataValue("ADD_ORIENTATION_ROLL_NEXT_TICK") * partialTicks);
Vector3f Rotations = new Vector3f(180.0F - entity.GetVehicleYaw(),entity.GetVehiclePitch(),entity.GetVehicleRoll()); Vector3f Rotations = new Vector3f(180.0F - entity.GetVehicleYaw(),entity.GetVehiclePitch(),entity.GetVehicleRoll());
Rotations.add(RotationsToAdd);
switch(OriginType) { switch(OriginType) {
case PilotSeat: case PilotSeat:
OriginPosition = OriginPosition.add(entity.GetPilotSeat().x,entity.GetPilotSeat().y,entity.GetPilotSeat().z); OriginPosition = OriginPosition.add(entity.GetPilotSeat().x,entity.GetPilotSeat().y,entity.GetPilotSeat().z);
@@ -17,6 +17,7 @@ import net.minecraft.network.datasync.EntityDataManager;
import net.minecraft.util.ActionResultType; import net.minecraft.util.ActionResultType;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import net.minecraft.util.math.vector.Vector3d; import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.util.text.StringTextComponent;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.fml.network.NetworkHooks; import net.minecraftforge.fml.network.NetworkHooks;
@@ -54,13 +55,17 @@ public class VehicleBaseEntity extends Entity {
vehicleClassification = vehicleBuildInfo.GetVehicleClassification(); vehicleClassification = vehicleBuildInfo.GetVehicleClassification();
EngineType = vehicleBuildInfo.GetEngineType(); EngineType = vehicleBuildInfo.GetEngineType();
float PropRotation = (float)(360 * Math.random()); float PropRotation = (float)(360 * Math.random());
BASE_DOUBLE_PARAMETERS.put("GRAVITY",!vehicleBuildInfo.GetAdheresToGravity() ? 0 : vehicleBuildInfo.GetGravityStrength()); BASE_DOUBLE_PARAMETERS.put("GRAVITY",!vehicleBuildInfo.GetAdheresToGravity() ? 0 : vehicleBuildInfo.GetGravityStrength()/200.0);
BASE_BOOL_PARAMETERS.put("ADHERES_TO_GRAVITY",vehicleBuildInfo.GetAdheresToGravity());
BASE_DOUBLE_PARAMETERS.put("CENTRE_OF_MASS_X",vehicleBuildInfo.GetCentreOfMass().x); BASE_DOUBLE_PARAMETERS.put("CENTRE_OF_MASS_X",vehicleBuildInfo.GetCentreOfMass().x);
BASE_DOUBLE_PARAMETERS.put("CENTRE_OF_MASS_Y",vehicleBuildInfo.GetCentreOfMass().y); BASE_DOUBLE_PARAMETERS.put("CENTRE_OF_MASS_Y",vehicleBuildInfo.GetCentreOfMass().y);
BASE_DOUBLE_PARAMETERS.put("CENTRE_OF_MASS_Z",vehicleBuildInfo.GetCentreOfMass().z); BASE_DOUBLE_PARAMETERS.put("CENTRE_OF_MASS_Z",vehicleBuildInfo.GetCentreOfMass().z);
BASE_FLOAT_PARAMETERS.put("ORIENTATION_YAW",0f); BASE_FLOAT_PARAMETERS.put("ORIENTATION_YAW",0f);
BASE_FLOAT_PARAMETERS.put("ADD_ORIENTATION_YAW_NEXT_TICK",0f);
BASE_FLOAT_PARAMETERS.put("ORIENTATION_PITCH",0f); BASE_FLOAT_PARAMETERS.put("ORIENTATION_PITCH",0f);
BASE_FLOAT_PARAMETERS.put("ADD_ORIENTATION_PITCH_NEXT_TICK",0f);
BASE_FLOAT_PARAMETERS.put("ORIENTATION_ROLL",0f); BASE_FLOAT_PARAMETERS.put("ORIENTATION_ROLL",0f);
BASE_FLOAT_PARAMETERS.put("ADD_ORIENTATION_ROLL_NEXT_TICK",0f);
BASE_FLOAT_PARAMETERS.put("PROPELLER_ROTATION",PropRotation); BASE_FLOAT_PARAMETERS.put("PROPELLER_ROTATION",PropRotation);
BASE_FLOAT_PARAMETERS.put("TARGET_PROPELLER_ROTATION",PropRotation); BASE_FLOAT_PARAMETERS.put("TARGET_PROPELLER_ROTATION",PropRotation);
BASE_FLOAT_PARAMETERS.put("PROPELLER_ROTATION_SPEED",0F); BASE_FLOAT_PARAMETERS.put("PROPELLER_ROTATION_SPEED",0F);
@@ -76,6 +81,7 @@ public class VehicleBaseEntity extends Entity {
BASE_INT_PARAMETERS.put("YAW_CONTROL_INPUT",0); BASE_INT_PARAMETERS.put("YAW_CONTROL_INPUT",0);
BASE_INT_PARAMETERS.put("ROLL_CONTROL_INPUT",0); BASE_INT_PARAMETERS.put("ROLL_CONTROL_INPUT",0);
BASE_INT_PARAMETERS.put("PITCH_CONTROL_INPUT",0); BASE_INT_PARAMETERS.put("PITCH_CONTROL_INPUT",0);
BASE_STRING_PARAMETERS.put("PILOT_UUID","NULL");
List<String> VehicleKeybindActions = vehicleBuildInfo.GetVehicleInputActions(); List<String> VehicleKeybindActions = vehicleBuildInfo.GetVehicleInputActions();
byte[] VehicleByteActions = new byte[VehicleKeybindActions.size()]; byte[] VehicleByteActions = new byte[VehicleKeybindActions.size()];
final int[] index = {0}; final int[] index = {0};
@@ -182,6 +188,7 @@ public class VehicleBaseEntity extends Entity {
public UUID GetPilot(){ public UUID GetPilot(){
if(this.isBeingRidden() && this.getPassengers().get(0) instanceof ServerPlayerEntity){ if(this.isBeingRidden() && this.getPassengers().get(0) instanceof ServerPlayerEntity){
ServerPlayerEntity player = (ServerPlayerEntity) this.getPassengers().get(0); ServerPlayerEntity player = (ServerPlayerEntity) this.getPassengers().get(0);
if(!this.world.isRemote()){SetStringDataValue("PILOT_UUID",player.getUniqueID().toString());}
return player.getUniqueID(); return player.getUniqueID();
} }
return null; return null;
@@ -216,14 +223,60 @@ public class VehicleBaseEntity extends Entity {
@Override @Override
public void tick() { public void tick() {
super.tick(); super.tick();
if(GetBooleanDataValue("ADHERES_TO_GRAVITY")){
if (!this.isOnGround()) {
this.setMotion(this.getMotion().add(0, -GetDoubleDataValue("GRAVITY"), 0));
} else{
if(GetFloatDataValue("ORIENTATION_PITCH") % 90 != 0){
SetFloatDataValue("ORIENTATION_PITCH", Math.round(GetFloatDataValue("ORIENTATION_PITCH")/90.0f) * 90.0f);
}
}
this.move(net.minecraft.entity.MoverType.SELF, this.getMotion());
this.setMotion(this.getMotion().mul(0.98D, 0.98D, 0.98D));
}
SetFloatDataValue("ORIENTATION_PITCH",(GetFloatDataValue("ORIENTATION_PITCH") + GetFloatDataValue("ADD_ORIENTATION_PITCH_NEXT_TICK"))%360);
SetFloatDataValue("ADD_ORIENTATION_PITCH_NEXT_TICK",0f);
SetFloatDataValue("ORIENTATION_ROLL",(GetFloatDataValue("ORIENTATION_ROLL") + GetFloatDataValue("ADD_ORIENTATION_ROLL_NEXT_TICK"))%360);
SetFloatDataValue("ADD_ORIENTATION_ROLL_NEXT_TICK",0f);
SetFloatDataValue("ORIENTATION_YAW",(GetFloatDataValue("ORIENTATION_YAW") + GetFloatDataValue("ADD_ORIENTATION_YAW_NEXT_TICK"))%360);
SetFloatDataValue("ADD_ORIENTATION_YAW_NEXT_TICK",0f);
float CurrentPropRotation = GetFloatDataValue("TARGET_PROPELLER_ROTATION");
float PropIncrementAmount = GetFloatDataValue("PROPELLER_ROTATION_SPEED");
SetFloatDataValue("TARGET_PROPELLER_ROTATION",(CurrentPropRotation + PropIncrementAmount) % 360);
SetFloatDataValue("PROPELLER_ROTATION",CurrentPropRotation);
if(this.getMotion().z == 0 && this.getMotion().x == 0 && this.getMotion().y != 0){
double CenterOfMass = GetDoubleDataValue("CENTRE_OF_MASS_Z");
float CenterOfMassFloat = (float) CenterOfMass;
if(this.getMotion().y < 0){
if(GetFloatDataValue("ORIENTATION_PITCH") <= 0 && GetFloatDataValue("ORIENTATION_PITCH") > -90){
SetFloatDataValue("ADD_ORIENTATION_PITCH_NEXT_TICK", -CenterOfMassFloat);
} else if ( GetFloatDataValue("ORIENTATION_PITCH") <= 360 && GetFloatDataValue("ORIENTATION_PITCH") > 270){
SetFloatDataValue("ADD_ORIENTATION_PITCH_NEXT_TICK", CenterOfMassFloat);
} else if (GetFloatDataValue("ORIENTATION_PITCH") <= -90 && GetFloatDataValue("ORIENTATION_PITCH") > -180 ){
SetFloatDataValue("ADD_ORIENTATION_PITCH_NEXT_TICK", - CenterOfMassFloat);
} else if(GetFloatDataValue("ORIENTATION_PITCH") <= 270 && GetFloatDataValue("ORIENTATION_PITCH") > 180){
SetFloatDataValue("ADD_ORIENTATION_PITCH_NEXT_TICK", CenterOfMassFloat);
}
} else{
if(GetFloatDataValue("ORIENTATION_PITCH") <= 0 && GetFloatDataValue("ORIENTATION_PITCH") > -90){
SetFloatDataValue("ADD_ORIENTATION_PITCH_NEXT_TICK", CenterOfMassFloat);
} else if ( GetFloatDataValue("ORIENTATION_PITCH") <= 360 && GetFloatDataValue("ORIENTATION_PITCH") > 270){
SetFloatDataValue("ADD_ORIENTATION_PITCH_NEXT_TICK", -CenterOfMassFloat);
} else if (GetFloatDataValue("ORIENTATION_PITCH") <= -90 && GetFloatDataValue("ORIENTATION_PITCH") > -180 ){
SetFloatDataValue("ADD_ORIENTATION_PITCH_NEXT_TICK", CenterOfMassFloat);
} else if(GetFloatDataValue("ORIENTATION_PITCH") <= 270 && GetFloatDataValue("ORIENTATION_PITCH") > 180) {
SetFloatDataValue("ADD_ORIENTATION_PITCH_NEXT_TICK", -CenterOfMassFloat);
}
}
}
if(!this.getPassengers().isEmpty()){
//PlayerEntity player = (PlayerEntity) this.getControllingPassenger();
//player.sendMessage(new StringTextComponent(GetFloatDataValue("ORIENTATION_PITCH") + ""),player.getUniqueID());
}
TickUpdateEvent(); TickUpdateEvent();
if(this.world.isRemote()){ if(this.world.isRemote()){
ClientSideTickEvent(); ClientSideTickEvent();
} else{ } else{
float CurrentPropRotation = GetFloatDataValue("TARGET_PROPELLER_ROTATION");
float PropIncrementAmount = GetFloatDataValue("PROPELLER_ROTATION_SPEED");
SetFloatDataValue("TARGET_PROPELLER_ROTATION",(CurrentPropRotation + PropIncrementAmount) % 36000);
SetFloatDataValue("PROPELLER_ROTATION",CurrentPropRotation);
ServerSideTickEvent(); ServerSideTickEvent();
} }
} }
@@ -255,6 +308,7 @@ public class VehicleBaseEntity extends Entity {
public ActionResultType processInitialInteract(PlayerEntity player, Hand hand) { public ActionResultType processInitialInteract(PlayerEntity player, Hand hand) {
if (this.getPassengers().size() < VehicleSeatOffsets.length && !player.isPassenger()) { if (this.getPassengers().size() < VehicleSeatOffsets.length && !player.isPassenger()) {
if (!this.world.isRemote()) { if (!this.world.isRemote()) {
if(this.getPassengers().isEmpty()){SetStringDataValue("PILOT_UUID",player.getUniqueID().toString());}
return player.startRiding(this) ? ActionResultType.CONSUME : ActionResultType.PASS; return player.startRiding(this) ? ActionResultType.CONSUME : ActionResultType.PASS;
} }
return ActionResultType.func_233537_a_(this.world.isRemote()); return ActionResultType.func_233537_a_(this.world.isRemote());
@@ -13,6 +13,7 @@ import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod;
import java.util.Arrays; import java.util.Arrays;
import java.util.Objects;
@Mod.EventBusSubscriber(modid = Halsvehicleframework.MOD_ID, bus = Mod.EventBusSubscriber.Bus.FORGE) @Mod.EventBusSubscriber(modid = Halsvehicleframework.MOD_ID, bus = Mod.EventBusSubscriber.Bus.FORGE)
public class ModEventHandler { public class ModEventHandler {
@@ -27,7 +28,8 @@ public class ModEventHandler {
for(int i = 0; i < InputManager.ActiveKeys.size(); i++){ for(int i = 0; i < InputManager.ActiveKeys.size(); i++){
bytesFromBytes[i] = InputManager.ActiveKeys.get(i); bytesFromBytes[i] = InputManager.ActiveKeys.get(i);
} }
if(!Arrays.equals(bytesFromBytes, vehicle.GetByteArrayValue("INPUT_DATA"))) { System.out.println(vehicle.GetStringDataValue("PILOT_UUID") + "\n" + player.getUniqueID());
if(Objects.equals(vehicle.GetStringDataValue("PILOT_UUID"), player.getUniqueID().toString()) && !Arrays.equals(bytesFromBytes, vehicle.GetByteArrayValue("INPUT_DATA"))) {
InputArrayNetworking.INSTANCE.sendToServer(new InputArrayPacket(bytesFromBytes)); InputArrayNetworking.INSTANCE.sendToServer(new InputArrayPacket(bytesFromBytes));
} }
if(!InputManager.ActiveKeys.equals(InputManager.LastActiveKeys)){ if(!InputManager.ActiveKeys.equals(InputManager.LastActiveKeys)){
@@ -21,7 +21,9 @@ public class Aeroplane extends VehicleBaseEntity {
.SetMaxSpeedMS(70) .SetMaxSpeedMS(70)
.SetCentreOfMass(new Vector3d(0,0,2)) .SetCentreOfMass(new Vector3d(0,0,2))
.SetPilotSeat(new Vector3d(0.0D, -1D, 0.0D)) .SetPilotSeat(new Vector3d(0.0D, -1D, 0.0D))
.AddPassengerSeat(new Vector3d(0.0D, -1D, 1.0D)); .AddPassengerSeat(new Vector3d(0.0D, -1D, 1.0D))
.SetGravityStrength(9.8)
.AdhereToGravity(true);
public Aeroplane(EntityType<?> Type, World WorldIn) { public Aeroplane(EntityType<?> Type, World WorldIn) {
super(Type, WorldIn, buildInfo); super(Type, WorldIn, buildInfo);
@@ -20,6 +20,7 @@ public class Airboat extends VehicleBaseEntity {
.SetMaxSpeedMS(70) .SetMaxSpeedMS(70)
.SetGasCelCount(8) .SetGasCelCount(8)
.SetGasCelCapacity(1000) .SetGasCelCapacity(1000)
.SetCentreOfMass(new Vector3d(0,0,1))
.SetPilotSeat(new Vector3d(0.0D, -2D, 0.0D)) .SetPilotSeat(new Vector3d(0.0D, -2D, 0.0D))
.AddPassengerSeat(new Vector3d(0.0D, -2D, 2.0D)) .AddPassengerSeat(new Vector3d(0.0D, -2D, 2.0D))
.AddPassengerSeat(new Vector3d(0.0D, -2D, -2.0D)); .AddPassengerSeat(new Vector3d(0.0D, -2D, -2.0D));
@@ -1,5 +1,6 @@
package net.halbear.hvf.Util.Mixin; package net.halbear.hvf.Util.Mixin;
import net.halbear.hvf.Entity.VehicleBaseEntity;
import net.halbear.hvf.Halsvehicleframework; import net.halbear.hvf.Halsvehicleframework;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.ActiveRenderInfo; import net.minecraft.client.renderer.ActiveRenderInfo;
@@ -28,8 +29,8 @@ public abstract class CameraMixin {
@Inject(method = {"update", "func_216772_a","setup"}, at = @At(value = "TAIL"),cancellable = true, remap = true) @Inject(method = {"update", "func_216772_a","setup"}, at = @At(value = "TAIL"),cancellable = true, remap = true)
private void update(IBlockReader currentRenderedLevel, Entity entity, boolean isDetached, boolean isMirrored, float partialTicks, CallbackInfo ci){ private void update(IBlockReader currentRenderedLevel, Entity entity, boolean isDetached, boolean isMirrored, float partialTicks, CallbackInfo ci){
if(entity.isPassenger() && Minecraft.getInstance().gameSettings.getPointOfView() != PointOfView.FIRST_PERSON) { if(entity.isPassenger() && Minecraft.getInstance().gameSettings.getPointOfView() != PointOfView.FIRST_PERSON) {
ITag<EntityType<?>> myEntityTag = EntityTypeTags.getTagById(new ResourceLocation("forge", "hvf_camera_affected_vehicle").toString()); //ITag<EntityType<?>> myEntityTag = EntityTypeTags.getTagById(new ResourceLocation("forge", "hvf_camera_affected_vehicle").toString());
boolean entityHaveCameraPreset = myEntityTag.contains(entity.getRidingEntity().getType()); boolean entityHaveCameraPreset = entity.getRidingEntity() instanceof VehicleBaseEntity;//myEntityTag.contains(entity.getRidingEntity().getType());
if (entityHaveCameraPreset) { if (entityHaveCameraPreset) {
Vector3f Position = GetCameraOffsets(); Vector3f Position = GetCameraOffsets();
this.movePosition(-this.calcCameraDistance(Position.getZ()), Position.getY(), Position.getX()); this.movePosition(-this.calcCameraDistance(Position.getZ()), Position.getY(), Position.getX());
@@ -1,6 +1,7 @@
package net.halbear.hvf.Util.ServerSynchronisation; package net.halbear.hvf.Util.ServerSynchronisation;
import net.halbear.hvf.Entity.VehicleBaseEntity; import net.halbear.hvf.Entity.VehicleBaseEntity;
import net.halbear.hvf.Registry.Input.InputManager;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.player.ServerPlayerEntity; import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.network.PacketBuffer; import net.minecraft.network.PacketBuffer;
@@ -29,23 +30,26 @@ public class InputArrayPacket {
Context.enqueueWork(()->{ Context.enqueueWork(()->{
ServerPlayerEntity player = Context.getSender(); ServerPlayerEntity player = Context.getSender();
if (player != null) { if (player != null) {
String Message = ""; StringBuilder Message = new StringBuilder();
Entity playerEntity = player.getEntity(); Entity playerEntity = player.getEntity();
if(playerEntity.isPassenger()){ if(playerEntity.isPassenger()){
Entity PotentialVehicle = playerEntity.getRidingEntity(); Entity PotentialVehicle = playerEntity.getRidingEntity();
Message += " Entity: " + PotentialVehicle.getName().getString(); Message.append(" Entity: ").append(PotentialVehicle.getName().getString());
if(PotentialVehicle instanceof VehicleBaseEntity){ if(PotentialVehicle instanceof VehicleBaseEntity){
Message += " Is a HVF vehicle!"; Message.append(" Is a HVF vehicle!");
VehicleBaseEntity Vehicle = (VehicleBaseEntity)PotentialVehicle; VehicleBaseEntity Vehicle = (VehicleBaseEntity)PotentialVehicle;
if(Vehicle.GetPilot() == player.getUniqueID()) { if(Vehicle.GetPilot() == player.getUniqueID()) {
Vehicle.SetByteArrayValue("INPUT_DATA", packet.byteArray); Vehicle.SetByteArrayValue("INPUT_DATA", packet.byteArray);
Message += " Packet Sent By Pilot - SUCCESS"; Message.append(" Packet Sent By Pilot - SUCCESS\nActive Inputs:");
for(int i = 0; i < packet.byteArray.length; i++){
Message.append(InputManager.INPUT_BYTE_VALUES_REVERSE_LOOKUP.get(packet.byteArray[i])).append(", ");
}
} else{ } else{
Message += " Packet Sent By Passenger - REJECTED"; Message.append(" Packet Sent By Passenger - REJECTED");
} }
} }
} }
player.sendMessage(new StringTextComponent(Message),player.getUniqueID()); player.sendMessage(new StringTextComponent(Message.toString()),player.getUniqueID());
} }
}); });
Context.setPacketHandled(true); Context.setPacketHandled(true);
@@ -9,5 +9,6 @@ public enum EngineCategories {
Steam_Locomotive, Steam_Locomotive,
Diesel_Train_Engine, Diesel_Train_Engine,
Ship_Diesel_Engine, Ship_Diesel_Engine,
Rocket_Engine Rocket_Engine,
NO_COMBUSTION_ENGINE
} }
@@ -0,0 +1,6 @@
package net.halbear.hvf.Util.VehicleData;
public enum VehicleRotatesBy {
CUSTOM_ROTATIONS_ONLY,
BasedOnVelocityAndCenterOfMass
}