mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
Merge branch 'HbmMods:master' into New_master
This commit is contained in:
commit
b61d92a998
10
changelog
10
changelog
@ -2,6 +2,10 @@
|
||||
* Doors!
|
||||
* Your favorites from 1.12, the 7 remaining doors have finally been ported
|
||||
* Thanks to KoblizekXD for biting the bullet
|
||||
* Rubber boat
|
||||
* Made from latex or synthetic rubber
|
||||
* A much less jankier alternative to the vanilla boat. Rotations are silky smooth and done via the strafe keys instead of based on the player's orientation
|
||||
* Won't break from ramming into blocks
|
||||
|
||||
## Changed
|
||||
* Reduced the blast resistance of the large doors from absurdly high to still very but not quite as high
|
||||
@ -9,4 +13,8 @@
|
||||
* NTM's structures should no longer spawn in dimensions besides the overworld. Ores will still generate, assuming the config option is set.
|
||||
|
||||
## Fixed
|
||||
* Fixed ancient bug where custom missiles launched using the launch table would not use the accuracy calculation and always be pin-point accurate
|
||||
* Fixed ancient bug where custom missiles launched using the launch table would not use the accuracy calculation and always be pin-point accurate
|
||||
* Fixed RBMK heat exchangers being able to use heatable fluids that don't have heat exchanger efficiency defined like liquid sodium, heavy water and thorium salt
|
||||
* Fixed RBMK heat exchangers not using the heat exchanger efficiency variable to determine cooling power
|
||||
* Fixed the ballistic gauntlet spawning a client-side ghost bullet that doesn't move or despawn
|
||||
* Fixed bug where different custom machine cores would merge in a stack when picked up, turning them into the same type
|
||||
@ -155,6 +155,7 @@ public class ToolRecipes {
|
||||
CraftingManager.addRecipeAuto(ItemModMinecart.createCartItem(EnumCartBase.WOOD, EnumMinecart.EMPTY), new Object[] { "P P", "WPW", 'P',KEY_SLAB, 'W', KEY_PLANKS });
|
||||
CraftingManager.addRecipeAuto(ItemModMinecart.createCartItem(EnumCartBase.STEEL, EnumMinecart.EMPTY), new Object[] { "P P", "IPI", 'P', STEEL.plate(), 'I', STEEL.ingot() });
|
||||
CraftingManager.addShapelessAuto(ItemModMinecart.createCartItem(EnumCartBase.PAINTED, EnumMinecart.EMPTY), new Object[] { ItemModMinecart.createCartItem(EnumCartBase.STEEL, EnumMinecart.EMPTY), KEY_RED });
|
||||
CraftingManager.addRecipeAuto(new ItemStack(ModItems.boat_rubber), new Object[] { "L L", "LLL", 'L', ANY_RUBBER.ingot() });
|
||||
|
||||
for(EnumCartBase base : EnumCartBase.values()) {
|
||||
|
||||
|
||||
@ -222,6 +222,7 @@ public class EntityMappings {
|
||||
addEntity(EntityMist.class, "entity_mist", 250, false);
|
||||
addEntity(EntityAcidBomb.class, "entity_acid_bomb", 1000);
|
||||
addEntity(EntityFallingBlockNT.class, "entity_falling_block_nt", 1000);
|
||||
addEntity(EntityBoatRubber.class, "entity_rubber_boat", 250, false);
|
||||
|
||||
addEntity(EntityItemWaste.class, "entity_item_waste", 100);
|
||||
addEntity(EntityItemBuoyant.class, "entity_item_buoyant", 100);
|
||||
|
||||
485
src/main/java/com/hbm/entity/item/EntityBoatRubber.java
Normal file
485
src/main/java/com/hbm/entity/item/EntityBoatRubber.java
Normal file
@ -0,0 +1,485 @@
|
||||
package com.hbm.entity.item;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.util.TrackerUtil;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.EntityTrackerEntry;
|
||||
import net.minecraft.entity.item.EntityBoat;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldServer;
|
||||
|
||||
public class EntityBoatRubber extends Entity {
|
||||
|
||||
private boolean isBoatEmpty;
|
||||
private double speedMultiplier;
|
||||
private int boatPosRotationIncrements;
|
||||
private double boatX;
|
||||
private double boatY;
|
||||
private double boatZ;
|
||||
private double boatYaw;
|
||||
private double boatPitch;
|
||||
@SideOnly(Side.CLIENT) private double velocityX;
|
||||
@SideOnly(Side.CLIENT) private double velocityY;
|
||||
@SideOnly(Side.CLIENT) private double velocityZ;
|
||||
public float prevRenderYaw;
|
||||
|
||||
public EntityBoatRubber(World world) {
|
||||
super(world);
|
||||
this.isBoatEmpty = true;
|
||||
this.speedMultiplier = 0.07D;
|
||||
this.preventEntitySpawning = true;
|
||||
this.setSize(1.5F, 0.6F);
|
||||
this.yOffset = this.height / 2.0F;
|
||||
}
|
||||
|
||||
public EntityBoatRubber(World world, double x, double y, double z) {
|
||||
this(world);
|
||||
this.setPosition(x, y + (double) this.yOffset, z);
|
||||
this.motionX = 0.0D;
|
||||
this.motionY = 0.0D;
|
||||
this.motionZ = 0.0D;
|
||||
this.prevPosX = x;
|
||||
this.prevPosY = y;
|
||||
this.prevPosZ = z;
|
||||
}
|
||||
|
||||
protected void entityInit() {
|
||||
this.dataWatcher.addObject(17, new Integer(0));
|
||||
this.dataWatcher.addObject(18, new Integer(1));
|
||||
this.dataWatcher.addObject(19, new Float(0.0F));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canTriggerWalking() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBox(Entity entity) {
|
||||
return entity.boundingBox;
|
||||
}
|
||||
@Override
|
||||
public AxisAlignedBB getBoundingBox() {
|
||||
return this.boundingBox;
|
||||
}
|
||||
@Override
|
||||
public boolean canBePushed() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public double getMountedYOffset() {
|
||||
return (double) this.height * 0.0D - 0.3D;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean attackEntityFrom(DamageSource source, float amount) {
|
||||
if(this.isEntityInvulnerable()) {
|
||||
return false;
|
||||
} else if(!this.worldObj.isRemote && !this.isDead) {
|
||||
this.setForwardDirection(-this.getForwardDirection());
|
||||
this.setTimeSinceHit(10);
|
||||
this.setDamageTaken(this.getDamageTaken() + amount * 10.0F);
|
||||
this.setBeenAttacked();
|
||||
boolean hitByCreative = source.getEntity() instanceof EntityPlayer && ((EntityPlayer) source.getEntity()).capabilities.isCreativeMode;
|
||||
|
||||
if(hitByCreative || this.getDamageTaken() > 40.0F) {
|
||||
if(this.riddenByEntity != null) {
|
||||
this.riddenByEntity.mountEntity(this);
|
||||
}
|
||||
|
||||
if(!hitByCreative) {
|
||||
this.dropBoat();
|
||||
}
|
||||
|
||||
this.setDead();
|
||||
}
|
||||
|
||||
return true;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void performHurtAnimation() {
|
||||
this.setForwardDirection(-this.getForwardDirection());
|
||||
this.setTimeSinceHit(10);
|
||||
this.setDamageTaken(this.getDamageTaken() * 11.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBeCollidedWith() {
|
||||
return !this.isDead;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void setPositionAndRotation2(double x, double y, double z, float yaw, float pitch, int interp) {
|
||||
if(this.isBoatEmpty) {
|
||||
this.boatPosRotationIncrements = interp;
|
||||
} else {
|
||||
double d3 = x - this.posX;
|
||||
double d4 = y - this.posY;
|
||||
double d5 = z - this.posZ;
|
||||
double d6 = d3 * d3 + d4 * d4 + d5 * d5;
|
||||
|
||||
if(d6 <= 1.0D) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.boatPosRotationIncrements = 3;
|
||||
}
|
||||
|
||||
this.boatX = x;
|
||||
this.boatY = y;
|
||||
this.boatZ = z;
|
||||
this.boatYaw = (double) yaw;
|
||||
this.boatPitch = (double) pitch;
|
||||
this.motionX = this.velocityX;
|
||||
this.motionY = this.velocityY;
|
||||
this.motionZ = this.velocityZ;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void setVelocity(double x, double y, double z) {
|
||||
this.velocityX = this.motionX = x;
|
||||
this.velocityY = this.motionY = y;
|
||||
this.velocityZ = this.motionZ = z;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
//this.prevRotationYaw = this.rotationYaw;
|
||||
|
||||
if(this.getTimeSinceHit() > 0) {
|
||||
this.setTimeSinceHit(this.getTimeSinceHit() - 1);
|
||||
}
|
||||
|
||||
if(this.getDamageTaken() > 0.0F) {
|
||||
this.setDamageTaken(this.getDamageTaken() - 1.0F);
|
||||
}
|
||||
|
||||
this.prevPosX = this.posX;
|
||||
this.prevPosY = this.posY;
|
||||
this.prevPosZ = this.posZ;
|
||||
|
||||
byte b0 = 5;
|
||||
double d0 = 0.0D;
|
||||
|
||||
for(int i = 0; i < b0; ++i) {
|
||||
double d1 = this.boundingBox.minY + (this.boundingBox.maxY - this.boundingBox.minY) * (double) (i + 0) / (double) b0 - 0.125D;
|
||||
double d3 = this.boundingBox.minY + (this.boundingBox.maxY - this.boundingBox.minY) * (double) (i + 1) / (double) b0 - 0.125D;
|
||||
AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox(this.boundingBox.minX, d1, this.boundingBox.minZ, this.boundingBox.maxX, d3, this.boundingBox.maxZ);
|
||||
|
||||
if(this.worldObj.isAABBInMaterial(axisalignedbb, Material.water)) {
|
||||
d0 += 1.0D / (double) b0;
|
||||
}
|
||||
}
|
||||
|
||||
double prevSpeedSq = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ);
|
||||
|
||||
if(prevSpeedSq > 0.2625D) {
|
||||
double cosYaw = Math.cos(this.rotationYaw * Math.PI / 180.0D);
|
||||
double sinYaw = Math.sin(this.rotationYaw * Math.PI / 180.0D);
|
||||
|
||||
for(double j = 0; j < 1.0D + prevSpeedSq * 60.0D; ++j) {
|
||||
double offset = (double) (this.rand.nextFloat() * 2.0F - 1.0F);
|
||||
double side = (double) (this.rand.nextInt(2) * 2 - 1) * 0.7D;
|
||||
double magX;
|
||||
double magZ;
|
||||
|
||||
if(this.rand.nextBoolean()) {
|
||||
magX = this.posX - cosYaw * offset * 0.8D + sinYaw * side;
|
||||
magZ = this.posZ - sinYaw * offset * 0.8D - cosYaw * side;
|
||||
this.worldObj.spawnParticle("splash", magX, this.posY - 0.125D, magZ, this.motionX, this.motionY, this.motionZ);
|
||||
} else {
|
||||
magX = this.posX + cosYaw + sinYaw * offset * 0.7D;
|
||||
magZ = this.posZ + sinYaw - cosYaw * offset * 0.7D;
|
||||
this.worldObj.spawnParticle("splash", magX, this.posY - 0.125D, magZ, this.motionX, this.motionY, this.motionZ);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(this.worldObj.isRemote && this.isBoatEmpty) {
|
||||
if(this.boatPosRotationIncrements > 0) {
|
||||
double x = this.posX + (this.boatX - this.posX) / (double) this.boatPosRotationIncrements;
|
||||
double y = this.posY + (this.boatY - this.posY) / (double) this.boatPosRotationIncrements;
|
||||
double z = this.posZ + (this.boatZ - this.posZ) / (double) this.boatPosRotationIncrements;
|
||||
double yaw = MathHelper.wrapAngleTo180_double(this.boatYaw - (double) this.rotationYaw);
|
||||
this.rotationYaw = (float) ((double) this.rotationYaw + yaw / (double) this.boatPosRotationIncrements);
|
||||
this.rotationPitch = (float) ((double) this.rotationPitch + (this.boatPitch - (double) this.rotationPitch) / (double) this.boatPosRotationIncrements);
|
||||
--this.boatPosRotationIncrements;
|
||||
this.setPosition(x, y, z);
|
||||
//this.setRotation(this.rotationYaw, this.rotationPitch);
|
||||
|
||||
} else {
|
||||
double x = this.posX + this.motionX;
|
||||
double y = this.posY + this.motionY;
|
||||
double z = this.posZ + this.motionZ;
|
||||
this.setPosition(x, y, z);
|
||||
|
||||
if(this.onGround) {
|
||||
this.motionX *= 0.5D;
|
||||
this.motionY *= 0.5D;
|
||||
this.motionZ *= 0.5D;
|
||||
}
|
||||
|
||||
this.passiveDeccelerate();
|
||||
}
|
||||
} else {
|
||||
if(d0 < 1.0D) {
|
||||
double d2 = d0 * 2.0D - 1.0D;
|
||||
this.motionY += 0.04D * d2;
|
||||
} else {
|
||||
if(this.motionY < 0.0D) {
|
||||
this.motionY /= 2.0D;
|
||||
}
|
||||
|
||||
this.motionY += 0.007000000216066837D;
|
||||
}
|
||||
|
||||
this.isAirBorne = false;
|
||||
|
||||
if(this.riddenByEntity != null && this.riddenByEntity instanceof EntityLivingBase) {
|
||||
EntityLivingBase entitylivingbase = (EntityLivingBase) this.riddenByEntity;
|
||||
|
||||
if(entitylivingbase.moveForward != 0 || entitylivingbase.moveStrafing != 0) {
|
||||
|
||||
Vec3 dir = Vec3.createVectorHelper(0, 0, 1);
|
||||
dir.rotateAroundY((float) -((this.rotationYaw + 90) * Math.PI / 180D));
|
||||
this.motionX += dir.xCoord * this.speedMultiplier * entitylivingbase.moveForward * 0.05D;
|
||||
this.motionZ += dir.zCoord * this.speedMultiplier * entitylivingbase.moveForward * 0.05D;
|
||||
|
||||
float prevYaw = this.rotationYaw;
|
||||
this.rotationYaw -= entitylivingbase.moveStrafing * 3;
|
||||
|
||||
Vec3 newMotion = Vec3.createVectorHelper(motionX, 0, motionZ);
|
||||
newMotion.rotateAroundY((float) (-(this.rotationYaw - prevYaw) * Math.PI / 180D));
|
||||
this.motionX = newMotion.xCoord;
|
||||
this.motionZ = newMotion.zCoord;
|
||||
|
||||
//HOLY HELL! if we don't shit ourselves over packets and send them at proper intervals, entities are suddenly smooth! who would have thought! mojang certainly didn't!
|
||||
EntityTrackerEntry entry = TrackerUtil.getTrackerEntry((WorldServer) worldObj, this.getEntityId());
|
||||
entry.lastYaw = MathHelper.floor_float(this.rotationYaw * 256.0F / 360.0F) + 10; //force-trigger rotation update
|
||||
}
|
||||
}
|
||||
|
||||
double speedSq = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ);
|
||||
|
||||
if(speedSq > 0.35D) {
|
||||
double d4 = 0.35D / speedSq;
|
||||
this.motionX *= d4;
|
||||
this.motionZ *= d4;
|
||||
speedSq = 0.35D;
|
||||
}
|
||||
|
||||
if(speedSq > prevSpeedSq && this.speedMultiplier < 0.35D) {
|
||||
this.speedMultiplier += (0.35D - this.speedMultiplier) / 35.0D;
|
||||
|
||||
if(this.speedMultiplier > 0.35D) {
|
||||
this.speedMultiplier = 0.35D;
|
||||
}
|
||||
} else {
|
||||
this.speedMultiplier -= (this.speedMultiplier - 0.07D) / 35.0D;
|
||||
|
||||
if(this.speedMultiplier < 0.07D) {
|
||||
this.speedMultiplier = 0.07D;
|
||||
}
|
||||
}
|
||||
|
||||
for(int index = 0; index < 4; ++index) {
|
||||
int x = MathHelper.floor_double(this.posX + ((double) (index % 2) - 0.5D) * 0.8D);
|
||||
int z = MathHelper.floor_double(this.posZ + ((double) (index / 2) - 0.5D) * 0.8D);
|
||||
|
||||
for(int yOff = 0; yOff < 2; ++yOff) {
|
||||
int y = MathHelper.floor_double(this.posY) + yOff;
|
||||
Block block = this.worldObj.getBlock(x, y, z);
|
||||
|
||||
if(block == Blocks.snow_layer) {
|
||||
this.worldObj.setBlockToAir(x, y, z);
|
||||
this.isCollidedHorizontally = false;
|
||||
} else if(block == Blocks.waterlily) {
|
||||
this.worldObj.func_147480_a(x, y, z, true);
|
||||
this.isCollidedHorizontally = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(this.onGround) {
|
||||
this.motionX *= 0.5D;
|
||||
this.motionY *= 0.5D;
|
||||
this.motionZ *= 0.5D;
|
||||
}
|
||||
|
||||
this.moveEntity(this.motionX, this.motionY, this.motionZ);
|
||||
|
||||
if(this.isCollidedHorizontally && prevSpeedSq > 0.2D) {
|
||||
this.motionX *= 0.25D;
|
||||
this.motionY *= 0.25D;
|
||||
this.motionZ *= 0.25D;
|
||||
|
||||
} else {
|
||||
this.passiveDeccelerate();
|
||||
}
|
||||
|
||||
this.rotationPitch = 0.0F;
|
||||
|
||||
if(!(this.riddenByEntity instanceof EntityLivingBase)) {
|
||||
double yaw = (double) this.rotationYaw;
|
||||
double deltaX = this.prevPosX - this.posX;
|
||||
double deltaZ = this.prevPosZ - this.posZ;
|
||||
|
||||
if(deltaX * deltaX + deltaZ * deltaZ > 0.001D) {
|
||||
yaw = (double) ((float) (Math.atan2(deltaZ, deltaX) * 180.0D / Math.PI));
|
||||
}
|
||||
|
||||
double rotationSpeed = MathHelper.wrapAngleTo180_double(yaw - (double) this.rotationYaw);
|
||||
|
||||
if(rotationSpeed > 20.0D) {
|
||||
rotationSpeed = 20.0D;
|
||||
}
|
||||
|
||||
if(rotationSpeed < -20.0D) {
|
||||
rotationSpeed = -20.0D;
|
||||
}
|
||||
|
||||
this.rotationYaw = (float) ((double) this.rotationYaw + rotationSpeed);
|
||||
}
|
||||
|
||||
this.setRotation(this.rotationYaw, this.rotationPitch);
|
||||
|
||||
if(!this.worldObj.isRemote) {
|
||||
List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.expand(0.2D, 0.0D, 0.2D));
|
||||
|
||||
if(list != null && !list.isEmpty()) {
|
||||
for(int k1 = 0; k1 < list.size(); ++k1) {
|
||||
Entity entity = (Entity) list.get(k1);
|
||||
|
||||
if(entity != this.riddenByEntity && entity.canBePushed() && (entity instanceof EntityBoatRubber || entity instanceof EntityBoat)) {
|
||||
entity.applyEntityCollision(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(this.riddenByEntity != null && this.riddenByEntity.isDead) {
|
||||
this.riddenByEntity = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void passiveDeccelerate() {
|
||||
this.motionX *= 0.99D;
|
||||
this.motionY *= 0.95D;
|
||||
this.motionZ *= 0.99D;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateRiderPosition() {
|
||||
if(this.riddenByEntity != null) {
|
||||
double offX = Math.cos((double) this.rotationYaw * Math.PI / 180.0D) * 0.4D;
|
||||
double offZ = Math.sin((double) this.rotationYaw * Math.PI / 180.0D) * 0.4D;
|
||||
this.riddenByEntity.setPosition(this.posX + offX, this.posY + this.getMountedYOffset() + this.riddenByEntity.getYOffset(), this.posZ + offZ);
|
||||
|
||||
if(this.riddenByEntity instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer) this.riddenByEntity;
|
||||
player.renderYawOffset = MathHelper.wrapAngleTo180_float(this.rotationYaw + 90F);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override protected void writeEntityToNBT(NBTTagCompound p_70014_1_) { }
|
||||
@Override protected void readEntityFromNBT(NBTTagCompound p_70037_1_) { }
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float getShadowSize() {
|
||||
return 0.0F;
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateFallState(double fall, boolean onGround) {
|
||||
int x = MathHelper.floor_double(this.posX);
|
||||
int y = MathHelper.floor_double(this.posY);
|
||||
int z = MathHelper.floor_double(this.posZ);
|
||||
|
||||
if(onGround) {
|
||||
if(this.fallDistance > 5.0F) {
|
||||
this.fall(this.fallDistance);
|
||||
|
||||
if(!this.worldObj.isRemote && !this.isDead) {
|
||||
this.setDead();
|
||||
this.dropBoat();
|
||||
}
|
||||
|
||||
this.fallDistance = 0.0F;
|
||||
}
|
||||
} else if(this.worldObj.getBlock(x, y - 1, z).getMaterial() != Material.water && fall < 0.0D) {
|
||||
this.fallDistance = (float) ((double) this.fallDistance - fall);
|
||||
}
|
||||
}
|
||||
|
||||
public void dropBoat() {
|
||||
this.func_145778_a(ModItems.boat_rubber, 1, 0.0F);
|
||||
}
|
||||
|
||||
public void setDamageTaken(float amount) {
|
||||
this.dataWatcher.updateObject(19, Float.valueOf(amount));
|
||||
}
|
||||
|
||||
public float getDamageTaken() {
|
||||
return this.dataWatcher.getWatchableObjectFloat(19);
|
||||
}
|
||||
|
||||
public void setTimeSinceHit(int time) {
|
||||
this.dataWatcher.updateObject(17, Integer.valueOf(time));
|
||||
}
|
||||
|
||||
public int getTimeSinceHit() {
|
||||
return this.dataWatcher.getWatchableObjectInt(17);
|
||||
}
|
||||
|
||||
public void setForwardDirection(int dir) {
|
||||
this.dataWatcher.updateObject(18, Integer.valueOf(dir));
|
||||
}
|
||||
|
||||
public int getForwardDirection() {
|
||||
return this.dataWatcher.getWatchableObjectInt(18);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void setIsBoatEmpty(boolean empty) {
|
||||
this.isBoatEmpty = empty;
|
||||
}
|
||||
}
|
||||
@ -1044,6 +1044,7 @@ public class ModItems {
|
||||
public static ItemEnumMulti canned_conserve;
|
||||
public static Item can_key;
|
||||
|
||||
public static Item boat_rubber;
|
||||
public static Item cart;
|
||||
public static Item train;
|
||||
public static Item drone;
|
||||
@ -3473,6 +3474,7 @@ public class ModItems {
|
||||
canned_conserve = (ItemEnumMulti) new ItemConserve().setUnlocalizedName("canned_conserve").setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":canned");
|
||||
can_key = new Item().setUnlocalizedName("can_key").setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":can_key");
|
||||
|
||||
boat_rubber = new ItemBoatRubber().setUnlocalizedName("boat_rubber").setTextureName(RefStrings.MODID + ":boat_rubber");
|
||||
cart = new ItemModMinecart().setUnlocalizedName("cart");
|
||||
train = new ItemTrain().setUnlocalizedName("train");
|
||||
drone = new ItemDrone().setUnlocalizedName("drone");
|
||||
@ -7726,7 +7728,8 @@ public class ModItems {
|
||||
GameRegistry.registerItem(injector_5htp, injector_5htp.getUnlocalizedName());
|
||||
GameRegistry.registerItem(injector_knife, injector_knife.getUnlocalizedName());
|
||||
|
||||
//Minecarts
|
||||
//Vehicles
|
||||
GameRegistry.registerItem(boat_rubber, boat_rubber.getUnlocalizedName());
|
||||
GameRegistry.registerItem(cart, cart.getUnlocalizedName());
|
||||
GameRegistry.registerItem(train, train.getUnlocalizedName());
|
||||
GameRegistry.registerItem(drone, drone.getUnlocalizedName());
|
||||
|
||||
@ -17,6 +17,8 @@ public class ItemCustomMachine extends ItemBlock {
|
||||
|
||||
public ItemCustomMachine(Block block) {
|
||||
super(block);
|
||||
this.setMaxDamage(0);
|
||||
this.setHasSubtypes(true);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
||||
102
src/main/java/com/hbm/items/tool/ItemBoatRubber.java
Normal file
102
src/main/java/com/hbm/items/tool/ItemBoatRubber.java
Normal file
@ -0,0 +1,102 @@
|
||||
package com.hbm.items.tool;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.entity.item.EntityBoatRubber;
|
||||
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ItemBoatRubber extends Item {
|
||||
|
||||
public ItemBoatRubber() {
|
||||
this.maxStackSize = 1;
|
||||
this.setCreativeTab(CreativeTabs.tabTransport);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
|
||||
|
||||
float f = 1.0F;
|
||||
float pitch = player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch) * f;
|
||||
float yaw = player.prevRotationYaw + (player.rotationYaw - player.prevRotationYaw) * f;
|
||||
double posX = player.prevPosX + (player.posX - player.prevPosX) * (double) f;
|
||||
double posY = player.prevPosY + (player.posY - player.prevPosY) * (double) f + 1.62D - (double) player.yOffset;
|
||||
double posZ = player.prevPosZ + (player.posZ - player.prevPosZ) * (double) f;
|
||||
float compZ = MathHelper.cos(-yaw * 0.017453292F - (float) Math.PI);
|
||||
float compX = MathHelper.sin(-yaw * 0.017453292F - (float) Math.PI);
|
||||
float mult = -MathHelper.cos(-pitch * 0.017453292F);
|
||||
float lookY = MathHelper.sin(-pitch * 0.017453292F);
|
||||
float lookX = compX * mult;
|
||||
float lookZ = compZ * mult;
|
||||
double reach = 5.0D;
|
||||
|
||||
Vec3 pos = Vec3.createVectorHelper(posX, posY, posZ);
|
||||
Vec3 target = pos.addVector((double) lookX * reach, (double) lookY * reach, (double) lookZ * reach);
|
||||
MovingObjectPosition mop = world.rayTraceBlocks(pos, target, true);
|
||||
|
||||
if(mop == null) {
|
||||
return stack;
|
||||
|
||||
} else {
|
||||
Vec3 look = player.getLook(f);
|
||||
boolean flag = false;
|
||||
double width = 1.0D;
|
||||
List list = world.getEntitiesWithinAABBExcludingEntity(player, player.boundingBox.addCoord(look.xCoord * reach, look.yCoord * reach, look.zCoord * reach).expand(width, width, width));
|
||||
|
||||
for(int i = 0; i < list.size(); ++i) {
|
||||
Entity entity = (Entity) list.get(i);
|
||||
|
||||
if(entity.canBeCollidedWith()) {
|
||||
float f10 = entity.getCollisionBorderSize();
|
||||
AxisAlignedBB axisalignedbb = entity.boundingBox.expand((double) f10, (double) f10, (double) f10);
|
||||
|
||||
if(axisalignedbb.isVecInside(pos)) {
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(flag) {
|
||||
return stack;
|
||||
|
||||
} else {
|
||||
if(mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
|
||||
int x = mop.blockX;
|
||||
int y = mop.blockY;
|
||||
int z = mop.blockZ;
|
||||
|
||||
if(world.getBlock(x, y, z) == Blocks.snow_layer) {
|
||||
--y;
|
||||
}
|
||||
|
||||
EntityBoatRubber entityboat = new EntityBoatRubber(world, (double) ((float) x + 0.5F), (double) ((float) y + 1.0F), (double) ((float) z + 0.5F));
|
||||
entityboat.rotationYaw = (float) (((MathHelper.floor_double((double) (player.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3) - 1) * 90);
|
||||
|
||||
if(!world.getCollidingBoundingBoxes(entityboat, entityboat.boundingBox.expand(-0.1D, -0.1D, -0.1D)).isEmpty()) {
|
||||
return stack;
|
||||
}
|
||||
|
||||
if(!world.isRemote) {
|
||||
world.spawnEntityInWorld(entityboat);
|
||||
}
|
||||
|
||||
if(!player.capabilities.isCreativeMode) {
|
||||
--stack.stackSize;
|
||||
}
|
||||
}
|
||||
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -714,6 +714,7 @@ public class ClientProxy extends ServerProxy {
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityMinecartCrate.class, new RenderMinecart());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityMinecartNTM.class, new RenderNeoCart());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityMagnusCartus.class, new RenderMagnusCartus());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityBoatRubber.class, new RenderBoatRubber());
|
||||
//trains
|
||||
RenderingRegistry.registerEntityRenderingHandler(SeatDummyEntity.class, new RenderEmpty());
|
||||
RenderingRegistry.registerEntityRenderingHandler(BoundingBoxDummyEntity.class, new RenderEmpty());
|
||||
|
||||
@ -822,7 +822,7 @@ public class ModEventHandler {
|
||||
EntityPlayer player = event.entityPlayer;
|
||||
ItemStack chestplate = player.inventory.armorInventory[2];
|
||||
|
||||
if(player.getHeldItem() == null && chestplate != null && ArmorModHandler.hasMods(chestplate)) {
|
||||
if(!player.worldObj.isRemote && player.getHeldItem() == null && chestplate != null && ArmorModHandler.hasMods(chestplate)) {
|
||||
ItemStack[] mods = ArmorModHandler.pryMods(chestplate);
|
||||
ItemStack servo = mods[ArmorModHandler.servos];
|
||||
|
||||
|
||||
@ -0,0 +1,74 @@
|
||||
package com.hbm.render.entity.item;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.entity.item.EntityBoatRubber;
|
||||
import com.hbm.lib.RefStrings;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelBoat;
|
||||
import net.minecraft.client.renderer.entity.Render;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class RenderBoatRubber extends Render {
|
||||
|
||||
private static final ResourceLocation boatTextures = new ResourceLocation(RefStrings.MODID + ":textures/entity/boat_rubber.png");
|
||||
protected ModelBase modelBoat;
|
||||
|
||||
public RenderBoatRubber() {
|
||||
this.shadowSize = 0.5F;
|
||||
this.modelBoat = new ModelBoat();
|
||||
}
|
||||
|
||||
public void doRender(EntityBoatRubber entity, double x, double y, double z, float yaw, float interp) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float) x, (float) y, (float) z);
|
||||
GL11.glRotatef(180.0F - yaw, 0.0F, 1.0F, 0.0F);
|
||||
float f2 = (float) entity.getTimeSinceHit() - interp;
|
||||
float f3 = entity.getDamageTaken() - interp;
|
||||
|
||||
if(f3 < 0.0F) {
|
||||
f3 = 0.0F;
|
||||
}
|
||||
|
||||
if(f2 > 0.0F) {
|
||||
GL11.glRotatef(MathHelper.sin(f2) * f2 * f3 / 10.0F * (float) entity.getForwardDirection(), 1.0F, 0.0F, 0.0F);
|
||||
}
|
||||
|
||||
EntityPlayer me = Minecraft.getMinecraft().getMinecraft().thePlayer;
|
||||
|
||||
if(entity.riddenByEntity == me) {
|
||||
float diff = MathHelper.wrapAngleTo180_float(entity.rotationYaw - entity.prevRenderYaw);
|
||||
me.rotationYaw += diff;
|
||||
me.rotationYawHead += diff;
|
||||
}
|
||||
|
||||
entity.prevRenderYaw = entity.rotationYaw;
|
||||
|
||||
float f4 = 0.75F;
|
||||
GL11.glScalef(f4, f4, f4);
|
||||
GL11.glScalef(1.0F / f4, 1.0F / f4, 1.0F / f4);
|
||||
this.bindEntityTexture(entity);
|
||||
GL11.glScalef(-1.0F, -1.0F, 1.0F);
|
||||
this.modelBoat.render(entity, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
protected ResourceLocation getEntityTexture(EntityBoatRubber entity) {
|
||||
return boatTextures;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(Entity entity) {
|
||||
return this.getEntityTexture((EntityBoatRubber) entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doRender(Entity entity, double x, double y, double z, float f0, float f1) {
|
||||
this.doRender((EntityBoatRubber) entity, x, y, z, f0, f1);
|
||||
}
|
||||
}
|
||||
@ -65,9 +65,10 @@ public class TileEntityRBMKHeater extends TileEntityRBMKSlottedBase implements I
|
||||
HeatingStep step = trait.getFirstStep();
|
||||
steam.setTankType(step.typeProduced);
|
||||
double tempRange = this.heat - steam.getTankType().temperature;
|
||||
double eff = trait.getEfficiency(HeatingType.HEATEXCHANGER);
|
||||
|
||||
if(tempRange > 0) {
|
||||
double TU_PER_DEGREE = 2_000D; //based on 1mB of water absorbing 200 TU as well as 0.1°C from an RBMK column
|
||||
if(tempRange > 0 && eff > 0) {
|
||||
double TU_PER_DEGREE = 2_000D * eff; //based on 1mB of water absorbing 200 TU as well as 0.1°C from an RBMK column
|
||||
int inputOps = feed.getFill() / step.amountReq;
|
||||
int outputOps = (steam.getMaxFill() - steam.getFill()) / step.amountProduced;
|
||||
int tempOps = (int) Math.floor((tempRange * TU_PER_DEGREE) / step.heatReq);
|
||||
|
||||
@ -1280,6 +1280,7 @@ item.blades_steel.name=Stahlsägeblatt
|
||||
item.blades_titanium.name=Titansägeblatt
|
||||
item.blowtorch.name=Lötlampe
|
||||
item.board_copper.name=Kupfertafel
|
||||
item.boat_rubber.name=Schlauchboot
|
||||
item.bobmazon_hidden.name=Versteckter Katalog
|
||||
item.bobmazon_machines.name=Bobmazon: Blöcke und Maschinen
|
||||
item.bobmazon_materials.name=Bobmazon: Ressourcen
|
||||
|
||||
@ -1941,6 +1941,7 @@ item.blades_steel.name=Steel Shredder Blades
|
||||
item.blades_titanium.name=Titanium Shredder Blades
|
||||
item.blowtorch.name=Blowtorch
|
||||
item.board_copper.name=Copper Panel
|
||||
item.boat_rubber.name=Rubber Boat
|
||||
item.bobmazon_hidden.name=Hidden Catalog
|
||||
item.bobmazon_machines.name=Bobmazon: Blocks and Machines
|
||||
item.bobmazon_materials.name=Bobmazon: Materials
|
||||
|
||||
BIN
src/main/resources/assets/hbm/textures/entity/boat_rubber.png
Normal file
BIN
src/main/resources/assets/hbm/textures/entity/boat_rubber.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 931 B |
BIN
src/main/resources/assets/hbm/textures/items/boat_rubber.png
Normal file
BIN
src/main/resources/assets/hbm/textures/items/boat_rubber.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 286 B |
Loading…
x
Reference in New Issue
Block a user