diff --git a/StevenDimDoors/mod_pocketDim/CommonTickHandler.java b/StevenDimDoors/mod_pocketDim/CommonTickHandler.java index 16463296..b821175b 100644 --- a/StevenDimDoors/mod_pocketDim/CommonTickHandler.java +++ b/StevenDimDoors/mod_pocketDim/CommonTickHandler.java @@ -45,7 +45,7 @@ public class CommonTickHandler implements ITickHandler try { - if(tickCount>200) + if(tickCount>100) { tickCount=0; int i=0; diff --git a/StevenDimDoors/mod_pocketDim/dimHelper.java b/StevenDimDoors/mod_pocketDim/dimHelper.java index d2ef5fac..d3ccc396 100644 --- a/StevenDimDoors/mod_pocketDim/dimHelper.java +++ b/StevenDimDoors/mod_pocketDim/dimHelper.java @@ -392,6 +392,7 @@ public class dimHelper extends DimensionManager } this.generateDoor(world,linkData); + if(Block.blocksList.length>=entity.worldObj.getBlockId(playerXCoord,playerYCoord+1,playerZCoord)&&!entity.worldObj.isAirBlock(playerXCoord,playerYCoord+1,playerZCoord)) diff --git a/StevenDimDoors/mod_pocketDim/mod_pocketDim.java b/StevenDimDoors/mod_pocketDim/mod_pocketDim.java index 75345b38..a8b6d248 100644 --- a/StevenDimDoors/mod_pocketDim/mod_pocketDim.java +++ b/StevenDimDoors/mod_pocketDim/mod_pocketDim.java @@ -420,10 +420,10 @@ public class mod_pocketDim GameRegistry.registerTileEntity(TileEntityDimDoor.class, "TileEntityDimDoor"); GameRegistry.registerTileEntity(TileEntityRift.class, "TileEntityRift"); - EntityRegistry.registerModEntity(MobObelisk.class, "Obelisk", this.obeliskID, this,40, 1, true); - EntityList.IDtoClassMapping.put(this.obeliskID, MobObelisk.class); - EntityList.entityEggs.put(this.obeliskID, new EntityEggInfo(this.obeliskID, 0, 0xffffff)); - LanguageRegistry.instance().addStringLocalization("entity.MobObelisk.Obelisk.name", "Obelisk"); + // EntityRegistry.registerModEntity(MobObelisk.class, "Obelisk", this.obeliskID, this,40, 1, true); + // EntityList.IDtoClassMapping.put(this.obeliskID, MobObelisk.class); + // EntityList.entityEggs.put(this.obeliskID, new EntityEggInfo(this.obeliskID, 0, 0xffffff)); + // LanguageRegistry.instance().addStringLocalization("entity.MobObelisk.Obelisk.name", "Obelisk"); diff --git a/StevenDimDoors/mod_pocketDim/ticking/MobObelisk.java b/StevenDimDoors/mod_pocketDim/ticking/MobObelisk.java index d8f995b2..af1d4582 100644 --- a/StevenDimDoors/mod_pocketDim/ticking/MobObelisk.java +++ b/StevenDimDoors/mod_pocketDim/ticking/MobObelisk.java @@ -1,16 +1,22 @@ package StevenDimDoors.mod_pocketDim.ticking; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityFlying; +import net.minecraft.entity.EntityLiving; import net.minecraft.entity.monster.EntityMob; +import net.minecraft.entity.monster.IMob; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.MathHelper; import net.minecraft.world.World; -public class MobObelisk extends EntityMob +public class MobObelisk extends EntityFlying implements IMob { public MobObelisk(World par1World) { super(par1World); this.texture="/mods/DimensionalDoors/textures/mobs/Monolith.png"; - this.setSize(4.0F, 4.0F); + this.setSize(2.5F, 7.0F); // TODO Auto-generated constructor stub } @@ -21,4 +27,64 @@ public class MobObelisk extends EntityMob return 20; } + @Override + public void onEntityUpdate() + { + // if(rand.nextInt(10)==0) + { + EntityPlayer entityPlayer = this.worldObj.getClosestPlayerToEntity(this, 100); + if(entityPlayer == null) + { + return; + } + this.faceEntity(entityPlayer, 100, 100); + } + super.onEntityUpdate(); + + System.out.println(this.rotationYaw); + System.out.println(this.rotationYawHead); + + } + + public void faceEntity(Entity par1Entity, float par2, float par3) + { + double d0 = par1Entity.posX - this.posX; + double d1 = par1Entity.posZ - this.posZ; + double d2; + + if (par1Entity instanceof EntityLiving) + { + EntityLiving entityliving = (EntityLiving)par1Entity; + d2 = entityliving.posY + (double)entityliving.getEyeHeight() - (this.posY + (double)this.getEyeHeight()); + } + else + { + d2 = (par1Entity.boundingBox.minY + par1Entity.boundingBox.maxY) - (this.posY + (double)this.getEyeHeight()); + } + + double d3 = (double)MathHelper.sqrt_double(d0 * d0 + d1 * d1); + float f2 = (float)(Math.atan2(d1, d0) * 180.0D / Math.PI) - 90.0F; + float f3 = (float)(-(Math.atan2(d2, d3) * 180.0D / Math.PI)); + this.rotationYaw = f2; + this.rotationYawHead=f2; + } + + private float updateRotation(float par1, float par2, float par3) + { + float f3 = MathHelper.wrapAngleTo180_float(par2 - par1); + + if (f3 > par3) + { + f3 = par3; + } + + if (f3 < -par3) + { + f3 = -par3; + } + + return par1 + f3; + } + + } \ No newline at end of file diff --git a/StevenDimDoors/mod_pocketDimClient/ModelMobObelisk.java b/StevenDimDoors/mod_pocketDimClient/ModelMobObelisk.java index 1c2289b5..43efa0ad 100644 --- a/StevenDimDoors/mod_pocketDimClient/ModelMobObelisk.java +++ b/StevenDimDoors/mod_pocketDimClient/ModelMobObelisk.java @@ -27,12 +27,13 @@ public class ModelMobObelisk extends ModelBase textureWidth = 256; textureHeight = 256; - wholemonolith = new ModelRenderer(this, 0, 1); - wholemonolith.addBox(0F, 0F, 0F, 64, 144, 16); - wholemonolith.setRotationPoint(-32F, -72F, -8F); + wholemonolith = new ModelRenderer(this, 0, 0); + wholemonolith.addBox(-32F, -72F, -8F, 32, 72, 8); wholemonolith.setTextureSize(256, 256); wholemonolith.mirror = true; - setRotation(wholemonolith, 0F, 0F, 0F); + this.wholemonolith.rotationPointY=16; + this.wholemonolith.rotationPointX=16; + this.wholemonolith.rotationPointZ=4; } @Override