Jump to content

MultiMote

Forge Modder
  • Posts

    257
  • Joined

  • Last visited

Everything posted by MultiMote

  1. Your your schematic getter returns null. Search in log for "I can't load schematic, because ...".
  2. Your code is correct. And you can pass meta directly, byte normally casts to int (world.setBlock(cx, cy, cz, b, spring.data[і]), 2); ). And another thing. Schematic spring = SchematicLoader.get("spring"); Don't forget to add extention to filename if you didnt do it.
  3. Block.class public boolean shouldSideBeRendered(IBlockAccess iblockaccess, x, y, z, side) { return true; }
  4. 1. Why do you use IItemRenderer instead of TileEntitySpecialRenderer? 2. To have TileEntity block must extend BlockContainer and have function @Override public TileEntity createNewTileEntity(World world, int i) { return new TileEntityBlock(); } 3. Also you should register your TileEntityBlock GameRegistry.registerTileEntity(TileEntityBlock.class, "tileEntityBlock"); 4. What do you want to do?
  5. I think you should add this to entity constructor: this.tasks.addTask(2, new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.0D, false)); this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 0, true)); And to set damage use this: protected void applyEntityAttributes() { super.applyEntityAttributes(); this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(3.0D); }
  6. targetPlayer.addChatMessage(new ChatComponentText("TEXT HERE").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.AQUA))); or targetPlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.AQUA + "TEXT HERE"));
  7. targetPlayer.addChatMessage(new ChatComponentText("TEXT HERE"));
  8. Have fun public ItemStack onItemRightClick(ItemStack is, World world, EntityPlayer ep) { double radius = 5; List<EntityItem> items = world.getEntitiesWithinAABB(EntityItem.class, ep.boundingBox.expand(radius, radius, radius)); for(EntityItem it : items){ double distX = ep.posX - it.posX; double distZ = ep.posZ - it.posZ; double distY = it.posY+1.5D - ep.posY; double dir = Math.atan2(distZ, distX); double speed = 1F / it.getDistanceToEntity(ep) * 0.5; if (distY<0) { it.motionY += speed; } it.motionX = Math.cos(dir) * speed; it.motionZ = Math.sin(dir) * speed; } return is; }
  9. Use this getter: ResourceLocation resourcelocation = AbstractClientPlayer.locationStevePng; String username = "Someone"; if (username > 0) { resourcelocation = AbstractClientPlayer.getLocationSkin(username); AbstractClientPlayer.getDownloadImageSkin(resourcelocation, username); }
  10. I mean you can use that method code as example and write your own =D
  11. Create class that extends GuiButton. And override GuiButton's render code.
  12. protected void onFoodEaten(ItemStack par1ItemStack, World par2World, EntityPlayer entity) { if(!par2World.isRemote) //do nothing at client par2World.setWorldTime(par2World.getWorldTime() + 16000); }
  13. @diesieben07 but it cause showing item tooltip & resets itemusecount every update tick. Is there a way to prevent this?
  14. event.player.addChatMessage(new ChatComponentTranslation("msg.config_update.name").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.DARK_RED)));
  15. public Schematic get(String schemname){ try { InputStream is = this.getClass().getClassLoader().getResourceAsStream("assets/mymod/schem/"+schemname); NBTTagCompound nbtdata = CompressedStreamTools.readCompressed(is); short width = nbtdata.getShort("Width"); short height = nbtdata.getShort("Height"); short length = nbtdata.getShort("Length"); byte[] blocks = nbtdata.getByteArray("Blocks"); byte[] data = nbtdata.getByteArray("Data"); System.out.println("schem size:" + width + " x " + height + " x " + length); NBTTagList tileentities = nbtdata.getTagList("TileEntities", 10); is.close(); return new Schematic(tileentities, width, height, length, blocks, data); } catch (Exception e) { System.out.println("I can't load schematic, because " + e.toString()); return null; } } public class Schematic{ public NBTTagList tileentities; public short width; public short height; public short length; public byte[] blocks; public byte[] data; public Schematic(NBTTagList tileentities, short width, short height, short length, byte[] blocks, byte[] data){ this.tileentities = tileentities; this.width = width; this.height = height; this.length = length; this.blocks = blocks; this.data = data; } } And it's from my item code, maybe it can help you: public boolean onItemUse(ItemStack is, EntityPlayer placer, World world, int x, int y, int z, int side, float px, float py, float pz) { if(!world.isRemote && !blocked && delay<=0 && side == 1 && placer.capabilities.isCreativeMode){ blocked = true; delay = 20; int rotation = OtherUtils.getPlayerRotationSide(placer); SchemUtils.Schematic sh = sut.get(schematic); if(sh==null){ placer.addChatMessage(new ChatComponentText("Schematic is dead!")); this.setUnlocalizedName("builder_corrupt"); return false;} if(logBuilding)placer.addChatMessage(new ChatComponentText("Building started.")); int i = 0; for(int sy = 0; sy < sh.height; sy++) for(int sz = 0; sz < sh.length; sz++) for(int sx = 0; sx < sh.width; sx++){ Block b = Block.getBlockById(sh.blocks[i]); if(b!= Blocks.air) { int rx = SchemUtils.blockCoordsRotation(sx - this.getxShift(), sz, rotation)[0]; int rz = SchemUtils.blockCoordsRotation(sx - this.getxShift(), sz, rotation)[1]; world.setBlockToAir(x + rx, y + ylevel + sy, z + rz); world.setBlock(x+rx, y+ylevel+sy, z+rz, b, SchemUtils.rotateMeta(sh.blocks[i], sh.data[i], rotation ), 2); } i++; } if (sh.tileentities != null) { for (int i1 = 0; i1 < sh.tileentities.tagCount(); ++i1) { NBTTagCompound nbttagcompound4 = sh.tileentities.getCompoundTagAt(i1); TileEntity tileentity = TileEntity.createAndLoadEntity(nbttagcompound4); if (tileentity != null) { int[] conv2 = SchemUtils.blockCoordsRotation(tileentity.xCoord - this.getxShift(), tileentity.zCoord, rotation); tileentity.xCoord = x + conv2[0]; tileentity.yCoord += y+ylevel; tileentity.zCoord = z + conv2[1]; world.setTileEntity(tileentity.xCoord, tileentity.yCoord, tileentity.zCoord, tileentity); } } } if(logBuilding) placer.addChatMessage(new ChatComponentText("Building finished.")); blocked = false; return true; } return false; }
  16. world.getBlock(x, y-1, z) ?
  17. Iterator it = Block.blockRegistry.iterator(); ArrayList<String> vanillaBlocks = new ArrayList<String>(); while (it.hasNext()) { Block b = (Block)it.next(); vanillaBlocks.add(b.getLocalizedName()); } System.out.println(vanillaBlocks.toString());
×
×
  • Create New...

Important Information

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