Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

tlr38usd

Members
  • Joined

  • Last visited

Everything posted by tlr38usd

  1. if (type.equals(EnumSet.of(TickType.SERVER))) vs. if (type.equals(EnumSet.of(TickType.WORLD)))?
  2. Ok, that gave me the list, but now that I have the list I'm not sure it's what I want. I'm using my server tick handler to check if a player has a flight buff and then do some calculations and then change the motionY player variable. What I had was this private void onWorldTick(World world) { EntityPlayer player = Minecraft.getMinecraft().thePlayer; Which worked fine in a single player world, but on lan only the player that started the game got the buff. I then tried this private void onWorldTick(World world) { List<EntityPlayer> players = MinecraftServer.getServer().getConfigurationManager().playerEntityList; for(int i = 0; i < players.size(); i++) { EntityPlayer player = players.get(i); But that seems like that makes the player a read-only variable. I can read the username, but that's pretty much it. I can't change the motionY or add velocity which doesn't make sense to me because it's the same EntityPlayer. Also in a server situation with hundreds of players would it be smart to have a for loop checking every player every tick. If not then what is the best way?
  3. I have the gameregistry registerTileEntity, when I tried adding yours instead it didn't work
  4. Could I somehow get an array of all the players on a server? If so how?
  5. That was quite anticlimactic, thanks! =D
  6. Just put that wherever? It doesn't seem to work in my tick handler. Looks like we can get the minecraft server from world, but I'm not sure about the client.
  7. How do I get the Minecraft variable? I found that, but I'm not sure how to get the minecraft variable
  8. I am trying to make a feature in my mod where when the player presses the jump button they can fly up, how do I get the jump button? I'm trying to put the finished code in a tick handler, am I in the right place and how would I get the minecraft gamesettings?
  9. A hook to add potions into the game would be nice.
  10. Ok, I found part of the problem. It seems like whenever I reload my world the tile entity is set to null.
  11. I tried both changing all of the world.isRemotes to false and just removing them entirely, when I did that it would save the data if I closed the world then reopened it. But if I closed the game and reopened it the nbt would not save.
  12. In my mod I have a couple of items with custom in-hand renders. I used to be able to use this MinecraftForgeClient.registerItemRenderer in my client proxy to register them, but it doesn't seem to be working. I'm in forge 775 by the way if that's important.
  13. I did try that, but it is a private float. There is the "public Multimap func_111205_h()" method that uses the weaponDamage float, but I haven't done much research on it yet.
  14. public weaponBase(int par1, weaponMaterials mat) { super(par1, base); this.toolMaterial = mat; this.setCreativeTab(CreativeTabs.tabCombat); this.maxStackSize = 1; base = EnumHelper.addToolMaterial("BASE", toolMaterial.harvestLevel, toolMaterial.maxUses, toolMaterial.efficiencyOnProperMaterial, damageModifier + toolMaterial.getDamageVsEntity(), toolMaterial.enchantability); } Am I constructing yet? =D Also the "base" thingy is the cheat I'm using that sorta works.
  15. What personally like to use is this int strikeLvl = EnchantmentHelper.getEnchantmentLevel( WeaponsCore.enchStrike.effectId, player.getCurrentEquippedItem()); if (strikeLvl > 0) { code here... } There you also get access to the enchantment level, but that's really just a personal preference.
  16. I am making a system of blocks that will connect together and they are bonded by a random number. This number is saved in the tile entity in nbt. However right now the nbt data won't save when I quit the game and is reset to 0 when I restart. Tile Entity: package AdvancedRedstone.TuxCraft.Blocks; import java.util.Random; import net.minecraft.block.material.Material; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; public class TileEntityPipe extends TileEntity { public NBTTagCompound stackTagCompound; public int networkID; public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); this.networkID = nbt.getInteger("networkID"); } public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); nbt.setInteger("networkID", this.networkID); } public boolean canUpdate() { return true; } @Override public void updateEntity() { if(this.worldObj.isRemote) { if( stackTagCompound != null ) { this.networkID = stackTagCompound.getInteger( "networkID" ); //System.out.println(this.networkID); } } } public void setID(int i) { if( stackTagCompound == null ) { stackTagCompound = new NBTTagCompound( ); } stackTagCompound.setInteger( "networkID", i ); this.networkID = i; } public void joinPipeSystem() { // TODO Auto-generated method stub } } Block: package AdvancedRedstone.TuxCraft.Blocks; import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.Icon; import net.minecraft.world.World; import AdvancedRedstone.TuxCraft.AdvancedRedstoneCore; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; public class BlockPipe extends Block { private String textureName; private String propGroup; private String behaviorGroup; Random rand = new Random(); public BlockPipe(int id, Material m, String s) { super(id, m); this.textureName = s; this.setUnlocalizedName(s); } @Override public void registerIcons(IconRegister icon) { this.blockIcon = icon.registerIcon(AdvancedRedstoneCore.modid + ":" + this.textureName); } public Block propertyGroup(String s, String s2) { PropertyGroups.propertyGroup(s, this); this.propGroup = s; this.behaviorGroup = s2; return this; } private boolean isTileProvider = true; @Override public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack stack) { if(world.isRemote) { TileEntityPipe tile = (TileEntityPipe) world.getBlockTileEntity(x, y, z); int ID = getBestNetworkID(world, x, y, z); if(ID != 0) { tile.setID(ID); } else { tile.setID(rand.nextInt()); } System.out.println(tile.networkID); } } private int getBestNetworkID(World world, int x, int y, int z) { int networkID = 0; int[] neighborID = new int[] {0, 0, 0, 0, 0, 0}; TileEntityPipe base = (TileEntityPipe) world.getBlockTileEntity(x, y, z); if(world.getBlockId(x + 1, y, z) == this.blockID) { TileEntityPipe tile = (TileEntityPipe) world.getBlockTileEntity(x + 1, y, z); neighborID[0] = tile.networkID; } if(world.getBlockId(x - 1, y, z) == this.blockID) { TileEntityPipe tile = (TileEntityPipe) world.getBlockTileEntity(x - 1, y, z); neighborID[1] = tile.networkID; } if(world.getBlockId(x, y + 1, z) == this.blockID) { TileEntityPipe tile = (TileEntityPipe) world.getBlockTileEntity(x, y + 1, z); neighborID[2] = tile.networkID; } if(world.getBlockId(x, y - 1, z) == this.blockID) { TileEntityPipe tile = (TileEntityPipe) world.getBlockTileEntity(x, y - 1, z); neighborID[3] = tile.networkID; } if(world.getBlockId(x, y, z + 1) == this.blockID) { TileEntityPipe tile = (TileEntityPipe) world.getBlockTileEntity(x, y, z + 1); neighborID[4] = tile.networkID; } if(world.getBlockId(x, y, z - 1) == this.blockID) { TileEntityPipe tile = (TileEntityPipe) world.getBlockTileEntity(x, y, z - 1); neighborID[5] = tile.networkID; } System.out.println(neighborID[0] + ", " + neighborID[1] + ", " + neighborID[2] + ", " + neighborID[3] + ", " + neighborID[4] + ", " + neighborID[5]); for(int i = 0; i < neighborID.length; i++) { if(networkID == 0 && neighborID[i] != 0 && neighborID[i] != networkID) { networkID = neighborID[i]; } else if(neighborID[i] == networkID) { networkID = neighborID[i]; } else if(neighborID[i] == 0 && networkID != 0) { } else { networkID = 0; } } return networkID; } @Override public boolean hasTileEntity(int metadata) { return true; } @Override public TileEntity createTileEntity(World world, int metadata) { return new TileEntityPipe(); } public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) { if(world.isRemote) { TileEntityPipe tile = (TileEntityPipe) world.getBlockTileEntity(x, y, z); System.out.println(String.valueOf(tile.networkID)); } return false; } } I know forge is not yet completely stable, so is this a forge error, or is this error on my side?
  17. Thank you for defending me Chibill. Now, when you say change the constructor I thought you meant change something other than the enumtoolmaterial and I was confused because I didn't see everything. This is the constructor I found in the minecraft src Item.java public static Item swordIron = (new ItemSword(11, EnumToolMaterial.IRON)).setUnlocalizedName("swordIron").func_111206_d("iron_sword"); This is my constructor battleAxes = new itemBattleAxe(idBase + weaponMaterials.weaponMats.length + i, weaponMaterials.weaponMats[i]).setUnlocalizedName(weaponMaterials.weaponMats[i].toolName + "Battleaxe"); This goes in a for loop that loops through all the weaponMats I have declared. I wanted to be able to remotely add and take away tool materials and I wanted my own variables (color, render passes, alternate textures etc.). So I went with that vs. the enumtoolmaterials. I only ask questions when I have exhausted all other sources and I expect I will be pointed in the right direction, not have my methods insulted. I am learning java through modding, that was my plan all along, and unless you count HTML as a solid programming language I had no prior experience so I'm sorry if I'm not in touch with your precious "lingo". I have made a small hack that works to an extent. static EnumToolMaterial base = EnumHelper.addToolMaterial("IRON", 2, 250, 6.0F, 0, 14); public weaponBase(int par1, weaponMaterials mat) { super(par1, base); this.toolMaterial = mat; this.setCreativeTab(CreativeTabs.tabCombat); this.maxStackSize = 1; base = EnumHelper.addToolMaterial("BASE", toolMaterial.harvestLevel, toolMaterial.maxUses, toolMaterial.efficiencyOnProperMaterial, damageModifier + toolMaterial.getDamageVsEntity(), toolMaterial.enchantability); } This gives me the scaled damages I want but it is lightyears away from working soundly. I used to use getDamageVsEntity but that broke in the 1.6 update, so is there a new way to do it without using enums?
  18. How do I change the constructor? Also, I'm not using EnumToolMaterials.
  19. I can't find out how to change weapon damage on my custom sword. I have it extending the item sword file because I want it to be enchantable, but I can't find a way to change the blue tooltip. I need to be able to change the weaponDamage field but I'm not sure how.
  20. Will I have to do some math that checks the way it's rotated and responds accordingly?
  21. I am adding enchants to my mod and one of them is to increase the speed when wearing enchanted leggings. I made a tick handler to check every tick whether the player is wearing enchanted leggings and then increase the motionX and motionZ of the player. Here is what I have so far. @Override public void tickStart(EnumSet<TickType> type, Object... tickData) { EntityPlayer player = (EntityPlayer) tickData[0]; int speedLvl = EnchantmentHelper.getEnchantmentLevel( TuxWeaponsCore.enchSpeed.effectId, player.getCurrentArmor(1)); if(speedLvl > 0) { player.motionX *= 2D; player.motionZ *= 2D; } } It knows when the leggings are being worn it just won't give the necessary speed boost. I'm not sure what is wrong, I have tried putting the code in both tick start and tick end.
  22. I hope the title makes sense. Basically my problem is that I am making a throwable entity that has a tail following it, but as of now the end of the tail is the hitbox, I want the front to be the hitbox. I have tried some different things with gltranslate but that moves the render relative to the world and not the hitbox.
  23. Some of the mod authors I have contacted and given permission to add support is the authors of Metallurgy, Twilight Forest, Thaumcraft, and Tinkers Construct along with a few others.
  24. Title says it. I want to add mod support for some other popular mods, but I don't want them to have to add any code on their end. How would I check if their mod exists then reference the mods items. I have tried to use methods where my code searches for the mod jar and if it exists then it refers to the items by the ids, but that is not always the most reliable method and will differ from person to person.
  25. I did I just copied it wrong. Works great now. Thanks!

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.