Failender
Forge Modder-
Posts
1091 -
Joined
-
Last visited
Everything posted by Failender
-
[1.8]getEntitiesWithinAABBExcludingEntity(...) gives me a empty list.
Failender replied to jokekid's topic in Modder Support
the order is not xzy, its xyz. new axisalignment(x1,y1,z1,x2,y2,z2) -
perfect. by the way why are there the methods getUniqueID? Both seem to return the same obj..
-
no1 will code ur mod for you. Just sng.
-
never used UUID by now.. How do I store them as nbt? Can I use UUID#toString and UUID#fromString?
-
dumb me thought if i set the blocks manually I also need to add the TE's . thank you I guess
-
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)
-
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; }
-
the method is Item#getDamageVsEntity in 1.8 (I hope its there for 1.7)
-
maybe creating a simple bow and overriding getDamageVsEntity will do the job. only a guess im not sure
-
dumb me. thank you
-
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
-
[1.8](apparently not so)little question about a player and his pets
Failender replied to jokekid's topic in Modder Support
http://docs.oracle.com/javase/7/docs/api/java/util/WeakHashMap.html -
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"; } } }
-
I'm working on a mod, and not real sure how to get started.
Failender replied to The Great Duck's topic in Modder Support
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. -
Block.blocksList and Blocks.blocksList don't work?
Failender replied to NightTerror6's topic in Modder Support
http://en.lmgtfy.com/?q=forge+event+handling -
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
-
http://www.minecraftforge.net/wiki/Basic_Tile_Entity try using google.
-
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
-
[1.7.10] How change texture 'onItemRightClick'
Failender replied to goodmanalex's topic in Modder Support
why do you want to change the texture? maybe making a new itemstack wiht a different item is right for ur purpose -
why and for every block?
-
Spawning my entity causes gamecrash[STILL UNSOLVED]
Failender replied to ItsAMysteriousYT's topic in Modder Support
dont. do. that. seriously thats what proxies are for -
Block.blocksList and Blocks.blocksList don't work?
Failender replied to NightTerror6's topic in Modder Support
correct me if im wrong but harvest check gets only fired if u cant harvest to allow harvesting -
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