Jump to content

Lambda

Members
  • Posts

    486
  • Joined

  • Last visited

Everything posted by Lambda

  1. just println... edit: System.out.println(this.pos.getX() + "," + this.pos.getY()+5d + "," + this.pos.getZ());
  2. okay, will repilcate it however, I'm still having an issue with the realitive positioning.. orginal coords 19,64,256 plus: this.pos.getX(), this.pos.getY()+5d, this.pos.getZ() equals: 20,635.0,256 This is where I'm confused though.
  3. I was able to find EntityLivingBase#attemptTeleport , however it seems to send me to the corner of the block, not up. player.attemptTeleport(this.pos.getX(), this.pos.getY() + 5, this.pos.getZ());
  4. Oh, yeah thought that would just move the entity to coords... Sorry about that! However, trying to use this: player.setLocationAndAngles(this.pos.getX(), this.pos.getY() + 5, this.pos.getZ(), player.cameraYaw, player.cameraPitch); Doesn't seem to do it either Wait I realized I change the subject, I'm trying to move the player right now.
  5. Okay, can someone tell me why: this.pos.getX() + "," + this.pos.getY()+5 + "," + this.pos.getZ() and original pos being : 19,64,256 equals: 19,635,256
  6. Hey there! So I have this TE that teleports the items above them to another location... for testing purposes I have it set so that it will move 5 blocks up realitive to the TE.. however it seems to send the items hundreds of blocks away, instead of 5 above.. Any fix? Here is the code: @Override public void updateEntity() { if (!world.isRemote) { itemsAbove = this.world.getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(this.pos.getX()-1, this.pos.getY(), this.pos.getZ() -1, this.pos.getX() + 1, this.pos.getY() + 2, this.pos.getZ() + 1)); if(!this.isRedstonePowered && !this.isPulseMode) { this.doWork(); } } } public void doWork() { if(itemsAbove.size() != 0) { for(EntityItem item : itemsAbove) { item.move(MoverType.PLAYER, this.pos.getX(),this.pos.getY()+1,this.pos.getZ()); System.out.println(item.getPosition()); System.out.println("Send Items!"); } }else { return; } }
  7. Yeah I could do that Will try..
  8. Ah, so I cant really access it via displayHud.. Well I guess I, scrap that.
  9. Wait I actually didnt explain whats happening eh? Well the HUD thats trying to access it seems to not return the correct size of the list.. as in it always returns 0.
  10. Hey there! So I'm having an issue with returning a value of mobs nearby, however, I cannot seem to access the size of the list... Here is the code for the TE: @Override public void updateEntity() { super.updateEntity(); if(!world.isRemote) { if (true) { //todo change to work. this.entityMobs = world.getEntitiesWithinAABB(EntityMob.class, new AxisAlignedBB(this.getPos().getX() - 3, this.getPos().getY() - 3, this.getPos().getZ() - 3, this.getPos().getX() + 3, this.getPos().getY() + 3, this.getPos().getZ() + 3)); if (entityMobs != null && entityMobs.size() != 0) { for (EntityMob entityMob : entityMobs) { if (entityMob.getHealth() <= 1f) { storage.receiveEnergyInternal(PRODUCE_PER_MOB, false); this.markDirty(); } } } } } } public int getMonstersNear() { if(this.world != null) { if(this.entityMobs != null) { if(this.entityMobs.size() != 0) { return this.entityMobs.size(); } } } return 0; } And storing the list globally via: public List<EntityMob> entityMobs; And the code accessing the TE: @Override @SideOnly(Side.CLIENT) public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution){ TileEntity tile = minecraft.world.getTileEntity(posHit.getBlockPos()); if(tile instanceof TileEntityBlockMobGen){ String strg; if(((TileEntityBlockMobGen) tile).getMonstersNear() == 0) { strg = StringUtil.localize("info."+ModUtil.MOD_ID+".noMobs"); }else { strg = StringUtil.localize("info."+ModUtil.MOD_ID+".mobAmount") + ": " + ((TileEntityBlockMobGen) tile).getMonstersNear(); } minecraft.fontRendererObj.drawStringWithShadow(TextFormatting.YELLOW+""+TextFormatting.ITALIC+strg, resolution.getScaledWidth()/2+35, resolution.getScaledHeight()/2-15, StringUtil.DECIMAL_COLOR_WHITE); } } *which is in the block code* Thanks,
  11. Minecraft Forums or Here @ the support and bug reports section. However I don't know their policy about 1.7.10..
  12. 1. 1.7.10 is not supported 2. This is not where you post your modpack errors.
  13. I don't think your getting help here, because you are still modding on 1.7.10, which is not supported here.
  14. hey there! So I'm creating an item that picks up an entity and stores it... However, I'm having trouble saving the entity to NBT. Thanks!
  15. Hey there! So I'm in need of detecting if a player right clicks my TE... Not really much to it Thanks.
  16. Okay, I probably should put my block class in there and how i'm registering, eh? Here is the class that does.. everything: public final class InitFluids{ public static Fluid fluidEmpoweredFluid; public static Block blockEmpoweredFluid; public static void init(){ fluidEmpoweredFluid = registerFluid("empoweredfluid", "block_empowered_fluid", EnumRarity.UNCOMMON); blockEmpoweredFluid = registerFluidBlock(fluidEmpoweredFluid, Material.WATER, "block_empowered_fluid"); } private static Fluid registerFluid(String fluidName, String fluidTextureName, EnumRarity rarity){ Fluid fluid = new CustomFluids(fluidName.toLowerCase(Locale.ROOT), fluidTextureName).setRarity(rarity); FluidRegistry.registerFluid(fluid); FluidRegistry.addBucketForFluid(fluid); return FluidRegistry.getFluid(fluid.getName()); } private static Block registerFluidBlock(Fluid fluid, Material material, String name){ return new BlockFluidFlowing(fluid, material, name); } } The 'CustomFluids' class: public class CustomFluids extends Fluid { public CustomFluids(String fluidName, String textureName){ super(fluidName, new ResourceLocation(ModUtil.MOD_ID, "blocks/"+textureName+"_still"), new ResourceLocation(ModUtil.MOD_ID, "blocks/"+textureName+"_flowing")); } @Override public String getUnlocalizedName(){ return "fluid."+ModUtil.MOD_ID+"."+this.unlocalizedName; } } Lastly, the block base: public class BlockFluidFlowing extends BlockFluidClassic implements ItemBlockBase.ICustomRarity{ private final String name; public BlockFluidFlowing(Fluid fluid, Material material, String unlocalizedName){ super(fluid, material); this.name = unlocalizedName; this.displacements.put(this, false); this.register(); } private void register(){ ItemUtil.registerBlock(this, this.getItemBlock(), this.getBaseName(), this.shouldAddCreative()); } protected String getBaseName(){ return this.name; } protected ItemBlockBase getItemBlock(){ return new ItemBlockBase(this); } public boolean shouldAddCreative(){ return false; } @Override public boolean canDisplace(IBlockAccess world, BlockPos pos){ return !world.getBlockState(pos).getMaterial().isLiquid() && super.canDisplace(world, pos); } @Override public boolean displaceIfPossible(World world, BlockPos pos){ return !world.getBlockState(pos).getMaterial().isLiquid() && super.displaceIfPossible(world, pos); } @Override public EnumRarity getRarity(ItemStack stack){ return EnumRarity.EPIC; } }
  17. Yes. However, I was able to have the event as a not static one, so I can now reference the class. Edit: Also, how would I find the entity that attacked the player / the closest entity.
  18. How would I make it so my Item gets destroyed after it saves the person?
  19. Disregard... I got it I think.
  20. Okay, Edit: Now I need to remove the item when the player is saved, here is what I have so far, I just don't know how to get an instance of the item, due to the method being static: @SubscribeEvent public static void LivingHurtEvent(LivingHurtEvent event) { if (event.getEntity() instanceof EntityPlayer) { IBaublesItemHandler baubles = BaublesApi.getBaublesHandler((EntityPlayer) event.getEntity()); for (int i = 0; i < baubles.getSlots(); i++) { if (baubles.getStackInSlot(i).getItem() instanceof ItemRedemptionAmulet) { if (!event.isCanceled()) { float health = ((EntityPlayer) event.getEntity()).getHealth(); if (health - (event.getAmount()) <= 0) { float tempMaxHealth = ((EntityPlayer) event.getEntity()).getMaxHealth(); ((EntityPlayer) event.getEntity()).setHealth((tempMaxHealth * .5f) * event.getAmount()); } } } } } }
  21. Thanks.
  22. Actually, I think I know why... Its because my method is not static, however, I need to access isEquipped so the baubles intergration will work
  23. Okay, this is what I have now: @SubscribeEvent public void LivingHurtEvent(LivingHurtEvent event){ System.out.println("event is being called"); if(event.getEntity() instanceof EntityPlayer) { if (!event.isCanceled() && this.isEquipped()) { System.out.println("bauble equppied and checking for damage"); float health = ((EntityPlayer) event.getEntity()).getHealth(); if (health - (event.getAmount()) <= 0) { System.out.println("OUCH! Giving health to player"); float tempMaxHealth = ((EntityPlayer) event.getEntity()).getMaxHealth(); ((EntityPlayer) event.getEntity()).setHealth(tempMaxHealth * .5f); //Gives 1/2 their health back. } } } } However, it seems not to call, due to any of the System.out are not printing.. Here is how im registering them: MinecraftForge.EVENT_BUS.register(ItemRedemptionAmulet.class); correct?
  24. EDIT: (Removed above post, very self-explanatory.) Also, does this method need to be static?
  25. May I subscribe to an event inside the item class?
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.