tram passenger seats

This commit is contained in:
Bob 2023-05-07 20:30:54 +02:00
parent bfb1334b49
commit 73367570b8
15 changed files with 161 additions and 33 deletions

View File

@ -1,6 +1,6 @@
mod_version=1.0.27
# Empty build number makes a release type
mod_build_number=4585
mod_build_number=4592
credits=HbMinecraft, rodolphito (explosion algorithms), grangerave (explosion algorithms),\
\ Hoboy (textures, models), Doctor17 (russian localization), Drillgon200 (effects, models, porting),\

View File

@ -14,6 +14,7 @@ import com.hbm.entity.mob.botprime.*;
import com.hbm.entity.mob.siege.*;
import com.hbm.entity.particle.*;
import com.hbm.entity.projectile.*;
import com.hbm.entity.train.EntityRailCarRidable.SeatDummyEntity;
import com.hbm.entity.train.TrainCargoTram;
import com.hbm.main.MainRegistry;
import com.hbm.util.Tuple.Quartet;
@ -209,7 +210,8 @@ public class EntityMappings {
addEntity(EntitySawblade.class, "entity_stray_saw", 1000);
addEntity(EntityChemical.class, "entity_chemthrower_splash", 1000);
addEntity(EntityMist.class, "entity_mist", 1000);
addEntity(SeatDummyEntity.class, "entity_ntm_seat_dummy", 250, false);
addEntity(TrainCargoTram.class, "entity_ntm_cargo_tram", 250, false);
addMob(EntityCreeperNuclear.class, "entity_mob_nuclear_creeper", 0x204131, 0x75CE00);

View File

@ -2,9 +2,11 @@ package com.hbm.entity.mob;
import com.hbm.explosion.vanillant.ExplosionVNT;
import com.hbm.explosion.vanillant.standard.*;
import com.hbm.items.ModItems;
import net.minecraft.entity.monster.EntityCreeper;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
public class EntityCreeperGold extends EntityCreeper {
@ -19,8 +21,8 @@ public class EntityCreeperGold extends EntityCreeper {
if(!this.worldObj.isRemote) {
this.setDead();
ExplosionVNT vnt = new ExplosionVNT(worldObj, posX, posY, posZ, 7);
vnt.setBlockAllocator(new BlockAllocatorBulkie(60));
ExplosionVNT vnt = new ExplosionVNT(worldObj, posX, posY, posZ, this.getPowered() ? 14 : 7, this);
vnt.setBlockAllocator(new BlockAllocatorBulkie(60, this.getPowered() ? 32 : 16));
vnt.setBlockProcessor(new BlockProcessorStandard().withBlockEffect(new BlockMutatorBulkie(Blocks.gold_ore)));
vnt.setEntityProcessor(new EntityProcessorStandard().withRangeMod(0.5F));
vnt.setPlayerProcessor(new PlayerProcessorStandard());
@ -33,4 +35,13 @@ public class EntityCreeperGold extends EntityCreeper {
public boolean getCanSpawnHere() {
return super.getCanSpawnHere() && this.posY <= 40;
}
@Override
protected void dropFewItems(boolean byPlayer, int looting) {
int amount = byPlayer ? 5 + rand.nextInt(6 + looting * 2) : 3;
for(int i = 0; i < amount; ++i) {
this.entityDropItem(new ItemStack(ModItems.crystal_gold), 0F);
}
}
}

View File

@ -3,8 +3,10 @@ package com.hbm.entity.mob;
import com.hbm.blocks.ModBlocks;
import com.hbm.explosion.vanillant.ExplosionVNT;
import com.hbm.explosion.vanillant.standard.*;
import com.hbm.items.ModItems;
import net.minecraft.entity.monster.EntityCreeper;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
public class EntityCreeperVolatile extends EntityCreeper {
@ -19,8 +21,8 @@ public class EntityCreeperVolatile extends EntityCreeper {
if(!this.worldObj.isRemote) {
this.setDead();
ExplosionVNT vnt = new ExplosionVNT(worldObj, posX, posY, posZ, 7);
vnt.setBlockAllocator(new BlockAllocatorBulkie(60));
ExplosionVNT vnt = new ExplosionVNT(worldObj, posX, posY, posZ, this.getPowered() ? 14 : 7, this);
vnt.setBlockAllocator(new BlockAllocatorBulkie(60, this.getPowered() ? 32 : 16));
vnt.setBlockProcessor(new BlockProcessorStandard().withBlockEffect(new BlockMutatorBulkie(ModBlocks.block_slag, 1)));
vnt.setEntityProcessor(new EntityProcessorStandard().withRangeMod(0.5F));
vnt.setPlayerProcessor(new PlayerProcessorStandard());
@ -33,4 +35,10 @@ public class EntityCreeperVolatile extends EntityCreeper {
public boolean getCanSpawnHere() {
return super.getCanSpawnHere() && this.posY <= 40;
}
@Override
protected void dropFewItems(boolean byPlayer, int looting) {
this.entityDropItem(new ItemStack(ModItems.sulfur, 2 + rand.nextInt(3)), 0F);
this.entityDropItem(new ItemStack(ModItems.stick_tnt, 1 + rand.nextInt(2)), 0F);
}
}

View File

@ -3,21 +3,13 @@ package com.hbm.entity.train;
import com.hbm.blocks.rail.IRailNTM;
import com.hbm.blocks.rail.IRailNTM.RailContext;
import com.hbm.blocks.rail.IRailNTM.TrackGauge;
import com.hbm.main.MainRegistry;
import com.hbm.packet.PacketDispatcher;
import com.hbm.packet.PlayerInformPacket;
import com.hbm.util.ChatBuilder;
import com.hbm.util.ParticleUtil;
import com.hbm.util.fauxpointtwelve.BlockPos;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.MathHelper;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
@ -96,9 +88,6 @@ public abstract class EntityRailCarBase extends Entity {
this.velocityChanged = true;
}
}
PacketDispatcher.wrapper.sendTo(new PlayerInformPacket(new ChatComponentText("Yaw: " + this.rotationYaw), 664, 3000), (EntityPlayerMP) worldObj.playerEntities.get(0));
PacketDispatcher.wrapper.sendTo(new PlayerInformPacket(new ChatComponentText("MYaw: " + this.movementYaw), 665, 3000), (EntityPlayerMP) worldObj.playerEntities.get(0));
}
}

View File

@ -1,30 +1,107 @@
package com.hbm.entity.train;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
public abstract class EntityRailCarRidable extends EntityRailCarBase {
public SeatDummyEntity[] passengerSeats;
public EntityRailCarRidable(World world) {
super(world);
this.passengerSeats = new SeatDummyEntity[this.getPassengerSeats().length];
}
@Override
public boolean interactFirst(EntityPlayer player) {
if(this.riddenByEntity != null && this.riddenByEntity instanceof EntityPlayer && this.riddenByEntity != player) {
return true;
} else {
if(!this.worldObj.isRemote) {
player.mountEntity(this);
if(worldObj.isRemote) return true;
double nearestDist = Double.POSITIVE_INFINITY;
int nearestSeat = -1;
Vec3[] seats = getPassengerSeats();
for(int i = 0; i < seats.length; i++) {
Vec3 seat = seats[i];
if(seat == null) continue;
if(passengerSeats[i] != null) continue;
seat.rotateAroundY((float) (-this.rotationYaw * Math.PI / 180));
double x = posX + seat.xCoord;
double y = posY + seat.yCoord;
double z = posZ + seat.zCoord;
double dist = Vec3.createVectorHelper(player.posX - x, player.posY - y, player.posZ - z).lengthVector();
if(dist < nearestDist) {
nearestDist = dist;
nearestSeat = i;
}
return true;
}
if(this.riddenByEntity == null) {
Vec3 seat = getRiderSeatPosition();
seat.rotateAroundY((float) (-this.rotationYaw * Math.PI / 180));
double x = posX + seat.xCoord;
double y = posY + seat.yCoord;
double z = posZ + seat.zCoord;
double dist = Vec3.createVectorHelper(player.posX - x, player.posY - y, player.posZ - z).lengthVector();
if(dist < nearestDist) {
nearestDist = dist;
nearestSeat = -1;
}
}
if(nearestDist > 20) return true;
if(nearestSeat == -1) {
player.mountEntity(this);
} else {
SeatDummyEntity dummySeat = new SeatDummyEntity(worldObj);
Vec3 passengerSeat = this.getPassengerSeats()[nearestSeat];
passengerSeat.rotateAroundY((float) (-this.rotationYaw * Math.PI / 180));
double x = posX + passengerSeat.xCoord;
double y = posY + passengerSeat.yCoord;
double z = posZ + passengerSeat.zCoord;
dummySeat.setPosition(x, y - 1, z);
passengerSeats[nearestSeat] = dummySeat;
worldObj.spawnEntityInWorld(dummySeat);
player.mountEntity(dummySeat);
}
return true;
}
@Override
public void onUpdate() {
super.onUpdate();
if(!worldObj.isRemote) {
Vec3[] seats = this.getPassengerSeats();
for(int i = 0; i < passengerSeats.length; i++) {
SeatDummyEntity seat = passengerSeats[i];
if(seat != null) {
if(seat.riddenByEntity == null) {
passengerSeats[i] = null;
seat.setDead();
} else {
Vec3 rot = seats[i];
rot.rotateAroundY((float) (-this.rotationYaw * Math.PI / 180));
double x = posX + rot.xCoord;
double y = posY + rot.yCoord;
double z = posZ + rot.zCoord;
seat.setPosition(x, y - 1, z);
seat.updateRiderPosition();
}
}
}
}
}
@Override
@ -40,4 +117,21 @@ public abstract class EntityRailCarRidable extends EntityRailCarBase {
/** Returns a Vec3 showing the relative position from the driver to the core */
public abstract Vec3 getRiderSeatPosition();
public abstract Vec3[] getPassengerSeats();
public static class SeatDummyEntity extends Entity {
public SeatDummyEntity(World world) { super(world); this.setSize(0.5F, 0.1F);}
@Override protected void entityInit() { }
@Override protected void writeEntityToNBT(NBTTagCompound nbt) { }
@Override public boolean writeToNBTOptional(NBTTagCompound nbt) { return false; }
@Override public void readEntityFromNBT(NBTTagCompound nbt) { this.setDead(); }
@Override
public void updateRiderPosition() {
if(this.riddenByEntity != null) {
this.riddenByEntity.setPosition(this.posX, this.posY + 1, this.posZ);
}
}
}
}

View File

@ -31,7 +31,7 @@ public class TrainCargoTram extends EntityRailCarRidable {
public double speed = 0;
public static final double maxSpeed = 0.5;
public static final double acceleration = 0.01;
public static final double deceleration = 0.75;
public static final double deceleration = 0.95;
@Override
public double getCurrentSpeed() { // in its current form, only call once per tick
@ -80,4 +80,17 @@ public class TrainCargoTram extends EntityRailCarRidable {
return true;
}
@Override
public boolean shouldRiderSit() {
return true;
}
@Override
public Vec3[] getPassengerSeats() {
return new Vec3[] {
Vec3.createVectorHelper(0.5, 1.75, -1.5),
Vec3.createVectorHelper(-0.5, 1.75, -1.5)
};
}
}

View File

@ -3,7 +3,7 @@ package com.hbm.lib;
public class RefStrings {
public static final String MODID = "hbm";
public static final String NAME = "Hbm's Nuclear Tech Mod";
public static final String VERSION = "1.0.27 BETA (4585)";
public static final String VERSION = "1.0.27 BETA (4592)";
//HBM's Beta Naming Convention:
//V T (X)
//V -> next release version

View File

@ -848,7 +848,7 @@ public class MainRegistry {
new OreCave(ModBlocks.stone_resource, 0).setThreshold(1.5D).setRangeMult(20).setYLevel(30).setMaxRange(20).withFluid(ModBlocks.sulfuric_acid_block); //sulfur
new OreCave(ModBlocks.stone_resource, 1).setThreshold(1.75D).setRangeMult(20).setYLevel(25).setMaxRange(20); //asbestos
new OreLayer3D(ModBlocks.stone_resource, EnumStoneType.HEMATITE.ordinal());
new BiomeCave().setThreshold(1.5D).setRangeMult(20).setYLevel(40).setMaxRange(20);
//new BiomeCave().setThreshold(1.5D).setRangeMult(20).setYLevel(40).setMaxRange(20);
//new OreLayer(Blocks.coal_ore, 0.2F).setThreshold(4).setRangeMult(3).setYLevel(70);
Compat.handleRailcraftNonsense();

View File

@ -210,7 +210,7 @@ public class ModEventHandlerClient {
Minecraft.getMinecraft().renderEngine.bindTexture(Gui.icons);
}*/
List<String> text = new ArrayList();
/*List<String> text = new ArrayList();
MovingObjectPosition pos = Library.rayTrace(player, 500, 1, false, true, false);
for(int i = 0; i < 2; i++) if(pos != null && pos.typeOfHit == pos.typeOfHit.BLOCK) {
@ -273,7 +273,7 @@ public class ModEventHandlerClient {
} while(distanceToCover != 0);
ILookOverlay.printGeneric(event, "DEBUG", 0xffff00, 0x4040000, text);
}
}*/
}
/// HANLDE ANIMATION BUSES ///

View File

@ -124,7 +124,12 @@ public class TileEntityMachinePress extends TileEntityMachineBase implements IGU
if(slots[0] != null && burnTime < 200 && TileEntityFurnace.getItemBurnTime(slots[0]) > 0) { // less than one operation stored? burn more fuel!
burnTime += TileEntityFurnace.getItemBurnTime(slots[0]);
this.decrStackSize(0, 1);
if(slots[0].stackSize == 1 && slots[0].getItem().hasContainerItem(slots[0])) {
slots[0] = slots[0].getItem().getContainerItem(slots[0]).copy();
} else {
this.decrStackSize(0, 1);
}
this.markChanged();
}

View File

@ -125,14 +125,16 @@ public class TileEntityTesla extends TileEntityMachineBase implements IEnergyUse
continue;
}
if(e instanceof EntityCreeper) {
((EntityCreeper)e).getDataWatcher().updateObject(17, Byte.valueOf((byte)1));
ret.add(new double[] {e.posX, e.posY + e.height / 2, e.posZ});
continue;
}
if(!(e instanceof EntityPlayer && ArmorUtil.checkForFaraday((EntityPlayer)e)))
if(e.attackEntityFrom(ModDamageSource.electricity, MathHelper.clamp_float(e.getMaxHealth() * 0.5F, 3, 20) / (float)targets.size()))
worldObj.playSoundAtEntity(e, "hbm:weapon.tesla", 1.0F, 1.0F);
if(e instanceof EntityCreeper) {
((EntityCreeper)e).getDataWatcher().updateObject(17, Byte.valueOf((byte)1));
}
double offset = 0;
if(source != null && e instanceof EntityPlayer && worldObj.isRemote)

View File

@ -504,9 +504,11 @@ entity.entity_ntm_radiation_blaze.name=Kernschmelze-Elementar
entity.hbm.entity_ntm_ufo.name=Marsianisches Invasionsschiff
entity.entity_mob_hunter_chopper.name=Jagdschrauber
entity.entity_mob_mask_man.name=Maskenmann
entity.entity_mob_gold_creeper.name=Goldener Creeper
entity.entity_mob_nuclear_creeper.name=Nuklearer Creeper
entity.entity_mob_phosgene_creeper.name=Phosgen-Creeper
entity.entity_mob_tainted_creeper.name=Verseuchter Creeper
entity.entity_mob_volatile_creeper.name=Instabiler Creeper
entity.entity_taint_crab.name=Verseuchte Krabbe
entity.entity_tesla_crab.name=Tesla-Krabbe
entity.hbm.entity_balls_o_tron.name=Balls-O-Tron Prime

View File

@ -950,9 +950,11 @@ entity.entity_ntm_radiation_blaze.name=Meltdown Elemental
entity.hbm.entity_ntm_ufo.name=Martian Invasion Ship
entity.entity_mob_hunter_chopper.name=Hunter Chopper
entity.entity_mob_mask_man.name=Mask Man
entity.entity_mob_gold_creeper.name=Golden Creeper
entity.entity_mob_nuclear_creeper.name=Nuclear Creeper
entity.entity_mob_phosgene_creeper.name=Phosgene Creeper
entity.entity_mob_tainted_creeper.name=Tainted Creeper
entity.entity_mob_volatile_creeper.name=Volatile Creeper
entity.entity_taint_crab.name=Taint Crab
entity.entity_tesla_crab.name=Tesla Crab
entity.hbm.entity_balls_o_tron.name=Balls-O-Tron Prime