Jump to content

Failender

Forge Modder
  • Posts

    1091
  • Joined

  • Last visited

Everything posted by Failender

  1. the order is not xzy, its xyz. new axisalignment(x1,y1,z1,x2,y2,z2)
  2. perfect. by the way why are there the methods getUniqueID? Both seem to return the same obj..
  3. no1 will code ur mod for you. Just sng.
  4. never used UUID by now.. How do I store them as nbt? Can I use UUID#toString and UUID#fromString?
  5. dumb me thought if i set the blocks manually I also need to add the TE's . thank you I guess
  6. place ur textures under src/main/resources/assets/MOID/epicsubfolder and access them via new ResourceLocation("MODID:epicsubfolder/texure.png"); (if u want to access them for gui rendering to bind it via bindTexture)
  7. Hey everyone, I am triing to create a block that, when placed, is removing itself and placing himself at pos.x 100 pos z . Everything is working fine. Problem is that I have problems to store the information I need inside the TileEntity. I need the name of the placer stored inside the TE ( on server side client side doenst matter) , but its always storing null. I am not sure if this is a problem with how I move the TE or sth else. Block code @Override public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) { if(!worldIn.isRemote && placer instanceof EntityPlayer) { worldIn.setBlockToAir(pos); worldIn.removeTileEntity(pos); pos = new BlockPos(pos.getX(), 100, pos.getZ()); worldIn.setBlockState(pos, ShadowsRising.baseBlock.getDefaultState()); worldIn.setTileEntity(pos, new TileEntityBase()); TileEntityBase base = (TileEntityBase) worldIn.getTileEntity(pos); base.setOwner(placer.getName()); ExtendedPlayer.get((EntityPlayer) placer).setBasePos(pos); } } @Override public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, Entity entityIn) { if(entityIn instanceof EntityPlayer && !worldIn.isRemote) { EntityPlayer player = (EntityPlayer) entityIn; TileEntityBase base = (TileEntityBase) worldIn.getTileEntity(pos); System.out.println(base.getOwner()); //null always if(base.getOwner()!=null && base.getOwner().equals(player.getName())) player.addPotionEffect(new PotionEffect(23, 210)); } } TE code private String owner; public void setOwner(String owner) { System.out.println("set: " +pos); //sanity checks System.out.println("set: "+worldObj.isRemote); //sanity checks this.owner = owner; } public String getOwner() { return owner; }
  8. the method is Item#getDamageVsEntity in 1.8 (I hope its there for 1.7)
  9. maybe creating a simple bow and overriding getDamageVsEntity will do the job. only a guess im not sure
  10. because u are always adding slots with inventory, never with inventoryCustom
  11. dumb me. thank you
  12. I am encountering a problem when building my mod and running it on the server. I know that the class not found exception is occuring because the server is triing to access EntityPlayerSP, which he isnt knowing (because hes a server). But I dont know know WHERE he is acessing it. The log seems to be in here at de.failender.shadowsrising.ShadowsRising.init(ShadowsRising.java:127) ~[shadowsRising.class:?] which is MinecraftForge.EVENT_BUS.register(new ShadowHandler()); To be honest. I have no idea. public class ShadowHandler { @SubscribeEvent public void entityConstructing(EntityConstructing event) { if(event.entity instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer) event.entity; if(ExtendedPlayer.get((EntityPlayer)event.entity)==null) { ExtendedPlayer.register(player); } } } @SubscribeEvent public void playerDamaged(LivingHurtEvent event) { if(event.entity.worldObj.isRemote) return; if(event.entity instanceof EntityPlayer){ EntityPlayer player =(EntityPlayer) event.entity; if(event.source.damageType.equals("fall") && player.isPotionActive(23)) event.setCanceled(true); else ExtendedPlayer.get((EntityPlayer) event.entity).damaged(event); } } @SubscribeEvent public void interact(PlayerInteractEvent event) { if(event.action == Action.RIGHT_CLICK_BLOCK) { Block block = event.entityPlayer.worldObj.getBlockState(event.pos).getBlock(); if (block==Blocks.furnace || block==Blocks.lit_furnace) { ShadowsRising.network.sendToServer(new OpenInventoryMessage(ShadowsRising.FURNACEID, event.pos.getX(), event.pos.getY(), event.pos.getZ())); event.setCanceled(true); } else if(block==Blocks.chest) { ShadowsRising.network.sendToServer(new OpenInventoryMessage(ShadowsRising.CHESTID, event.pos.getX(), event.pos.getY(), event.pos.getZ())); event.setCanceled(true); } else if(block==Blocks.crafting_table) { ShadowsRising.network.sendToServer(new OpenInventoryMessage(ShadowsRising.CRAFTINGID, event.pos.getX(), event.pos.getY(), event.pos.getZ())); event.setCanceled(true); } else if(block==Blocks.dispenser || block==Blocks.dropper) { ShadowsRising.network.sendToServer(new OpenInventoryMessage(ShadowsRising.DISPENSER, event.pos.getX(), event.pos.getY(), event.pos.getZ())); event.setCanceled(true); } else if(block==Blocks.hopper) { ShadowsRising.network.sendToServer(new OpenInventoryMessage(ShadowsRising.HOPPERID, event.pos.getX(), event.pos.getY(), event.pos.getZ())); event.setCanceled(true); } } } @SubscribeEvent public void guiOpened(GuiOpenEvent event) { EntityPlayer player = Minecraft.getMinecraft().thePlayer; if(event.gui==null) return; if(event.gui instanceof GuiInventory) { if(Minecraft.getMinecraft().thePlayer.capabilities.isCreativeMode) return; event.setCanceled(true); ShadowsRising.network.sendToServer(new OpenInventoryMessage(ShadowsRising.INVENTORYID, (int)player.posX, (int)player.posY, (int)player.posZ )); } } @SubscribeEvent public void cloning(PlayerEvent.Clone event) { ExtendedPlayer old = ExtendedPlayer.get(event.original); ExtendedPlayer ext = ExtendedPlayer.get(event.entityPlayer); NBTTagCompound compound = new NBTTagCompound(); old.saveNBTData(compound); ext.loadNBTData(compound); } @SubscribeEvent public void joining(EntityJoinWorldEvent event) { if(event.entity instanceof EntityPlayer &&! event.world.isRemote) { EntityPlayer player = (EntityPlayer) event.entity; ExtendedPlayer ext = ExtendedPlayer.get(player); if(!player.getEntityData().hasKey("FIRSTJOIN")){ player.getEntityData().setBoolean("FIRSTJOIN", false); ext.inventory.setInventorySlotContents(1, new ItemStack(ShadowsRising.oxygentank)); ext.inventory.setInventorySlotContents(2, new ItemStack(ShadowsRising.lapisCrystal)); ext.inventory.setInventorySlotContents(3, new ItemStack(ShadowsRising.shieldGenerator)); } } } @SubscribeEvent public void entityPickedItem(EntityItemPickupEvent event) { if(event.entityPlayer!=null && ! event.entityPlayer.worldObj.isRemote) { ItemStack stack = event.item.getDataWatcher().getWatchableObjectItemStack(10); if(!canItemBeAdded(stack, event.entityPlayer)) event.setCanceled(true); } } private boolean canItemBeAdded(ItemStack stack, EntityPlayer player) { ExtendedPlayer ext = ExtendedPlayer.get(player); ItemStack[] stacks = player.inventory.mainInventory; for(int i=0; i<ext.getInventoryLimit(); i++) { if(stacks[i]==null) return true; if(stack.isItemDamaged()) continue; if(stacks[i].getItem()==stack.getItem() && stacks[i].stackSize<64) { stacks[i].stackSize+=stack.stackSize; if(stacks[i].stackSize>64) { stack.stackSize = stacks[i].stackSize-64; stacks[i].stackSize=64; } } } return false; } } Crash log
  13. http://docs.oracle.com/javase/7/docs/api/java/util/WeakHashMap.html
  14. This example should help u public class BronzeArmor extends ItemArmor{ public BronzeArmor(ArmorMaterial material, int renderIndex, int armorType) { super(material, renderIndex, armorType); setCreativeTab(AdvancedTools.advancedToolsTab); } @Override public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) { if(slot!=2) { return "advancedtools:textures/models/armor/bronze_layer_1.png"; } else { return "advancedtools:textures/models/armor/bronze_layer_2.png"; } } }
  15. Im not really sure about what to answer here tbh. To code ur machines use Block wiht TileEntity ( the interface is called TileEntityProvider) For ur custom mobs start with making the model after that create them (various tutorials in the internet) and add Custom tasks to them.
  16. http://en.lmgtfy.com/?q=forge+event+handling
  17. so what is ur problem then? we cant help u if u just say "dont works" dont exepct to get a good mod without some effort
  18. http://www.minecraftforge.net/wiki/Basic_Tile_Entity try using google.
  19. you are not supposed to copy paste it. that code is for 1.8, u are in 1.7. if u know a bit about java and minecraft u can downgrade in no time
  20. why do you want to change the texture? maybe making a new itemstack wiht a different item is right for ur purpose
  21. why and for every block?
  22. dont. do. that. seriously thats what proxies are for
  23. correct me if im wrong but harvest check gets only fired if u cant harvest to allow harvesting
  24. http://www.minecraftforum.net/forums/mapping-and-modding/mapping-and-modding-tutorials/1571567-forge-1-6-4-1-8-eventhandler-and event handling will be important 4 you if u want to do such stuff
  25. no need to use events in ur own mob events are made to change vanilla behaviour. u can override attackEntityFrom. if the damage source is not explosive u can call the super method and let its do it thing, if its explosive just return true and ur done. 2 lines of code
×
×
  • Create New...

Important Information

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