Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Cadiboo

Members
  • Posts

    3624
  • Joined

  • Last visited

  • Days Won

    58

Everything posted by Cadiboo

  1. why not have the overlay as a block model & render the animated stuff inside it with a TESR or SmartModel
  2. This is not an excuse for staying on an outdated version AND is easily fixable AntVenom got one of his friends to make a mod (I think it was even server-side only) that allowed you to toggle 1.9 pvp on or off.
  3. in eclipse hover over the method...
  4. Does anyone know how I would rotate an object to look at a point (xyz entity location) in my TESR? I've gotten my 3 axis rotating perfectly when I only do one of them, but when I try to do all 3 of them, it doesn't work at all. (I'm using GlStateManager.rotate(angle, x, y, z) rather that Quaternions because I just cannot understand them). I'm relatively new to rendering, and haven't rendered anything more complex than ItemBlocks & Models in my TESRs before. Any help would be greatly appreciated. Link to the file in my GitHub: https://github.com/Cadiboo/WIPTech/blob/master/src/main/java/cadiboo/wiptech/client/render/tileentity/TESRWire.java Same code but with most comments removed @Override public void render(TileEntityWire tileEntity, double x, double y, double z, float partialTicks, int destroyStage, float alpha) { if (tileEntity.electrocutionTime > 0) { double dX; //entity xy&z - set later double dY; double dZ; final int NumberOfBranches = 1; //for rendering the electricity final int NumberOfPossibleSubBranches = 2; List<Entity> entities = tileEntity.getAllEntitiesWithinRangeAt(tileEntity.getPos().getX(), tileEntity.getPos().getY(), tileEntity.getPos().getZ(), 113); for (int i = 0; i < entities.size(); i++) { GlStateManager.pushMatrix(); GlStateManager.translate(x + 0.5, y + 0.5, z + 0.5); dX = entities.get(i).posX - tileEntity.getPos().getX() - 0.5; dY = entities.get(i).posY - tileEntity.getPos().getY() - 0.5; dZ = entities.get(i).posZ - tileEntity.getPos().getZ() - 0.5; //Y rotation double aa = dX; double bb = dZ; double cc = Math.sqrt(aa * aa + bb * bb); double angle = 180F / Math.PI * Math.acos((bb * bb - (-cc * cc) - aa * aa) / (2 * bb * cc)); GlStateManager.rotate(90F + (float) angle * (aa < 0 ? -1 : 1), 0, 1, 0); //X rotation aa = dY; bb = dX; cc = Math.sqrt(aa * aa + bb * bb); angle = 180F / Math.PI * Math.acos((bb * bb - (-cc * cc) - aa * aa) / (2 * bb * cc)); //GlStateManager.rotate(70F + (float) angle * (aa < 0 ? -1 : 1), 0, 0, 1); //Z rotation aa = dY; bb = dZ; cc = Math.sqrt(aa * aa + bb * bb); angle = 180F / Math.PI * Math.acos((bb * bb - (-cc * cc) - aa * aa) / (2 * bb * cc)); GlStateManager.rotate(270F + (float) angle * (aa < 0 ? 1 : -1), 1, 0, 0); //... render electricity GlStateManager.popMatrix(); } } //... render wires }
  5. Misread the question ^^^ He makes a good point why would forge ever make something for you that you should make yourself by overriding about 3 methods? You can have your tile entities extend a Base class that automagically handles this for you... If this is what you would like, try looking at https://www.programcreek.com/java-api-examples/?code=canitzp/Metalworks/Metalworks-master/src/main/java/de/canitzp/metalworks/machine/TileBase.java# and https://www.programcreek.com/java-api-examples/?code=canitzp/Metalworks/Metalworks-master/src/main/java/de/canitzp/metalworks/packet/PacketSyncTileEntity.java# It automagically writes all your capabilities to NBT & syncs it every half second. I had quite a few problems with it (Not syncing even when explicitly told to, writing every face to NBT, syncing way too often). I've solved them so you might want to check out my implementation of it (my version can also write stuff other than caps to NBT) My version of the Base tile class https://github.com/Cadiboo/WIPTech/blob/master/src/main/java/cadiboo/wiptech/tileentity/TileEntityBase.java My Sync Packet class and my networking class https://github.com/Cadiboo/WIPTech/blob/master/src/main/java/cadiboo/wiptech/handler/network/PacketSyncTileEntity.java https://github.com/Cadiboo/WIPTech/blob/master/src/main/java/cadiboo/wiptech/handler/network/PacketHandler.java 2 classes that use it in my mod (Turbine is very simple, but only writes capabilities while Wire also writes "lastRecieved") https://github.com/Cadiboo/WIPTech/blob/master/src/main/java/cadiboo/wiptech/tileentity/TileEntityTurbine.java https://github.com/Cadiboo/WIPTech/blob/master/src/main/java/cadiboo/wiptech/tileentity/TileEntityWire.java
  6. Probably not, about Metadata, here is a (badly named) thread about metadata (or lack of it) in 1.13. Basically you need a new block for Variants, but Facing is stored in your block state (Properties, setDefaultState.withProperty, everything the same, but without the old getStateFromMeta & getMetaFromState functions) Your 11 blocks each with 4 variants would yes, become 44 blocks. They would be probably be instantiated something like this block1_variant1 = new Block("block1_variant1"); block1_variant2 = new Block("block1_variant2"); block1_variant3 = new Block("block1_variant3"); block1_variant4 = new Block("block1_variant4"); block2_variant1 = new Block("block2_variant1"); //...
  7. so your saying that I need to move all my Item = new Item() s into RegistryEvent.Register<Item> event
  8. Do you know why? I call setRegistryName(MOD_ID, name); does this change this?
  9. I've never had any problems doing this, and I mis-spoke, this is how I am creating them, not how I'm registering them. Registration is done this way @SubscribeEvent public static void registerItems(final RegistryEvent.Register<Item> event) { event.getRegistry().registerAll(cadiboo.wiptech.init.Items.ITEMS); //... blocks & ore dict } Does this still break stuff? I've never had a single problem with this method.
  10. Personally, I think the first way is great because it allows you to instantiate the same class multiple times with different names. Isn't this the ultimate reduction of code? for example over half my items are instantiated in this way public static final ItemBase TITANIUM_NUGGET = new ItemBase("titanium_nugget").setNugget().setBeaconPayment(); Or even this way public static final ItemTool COPPER_SHOVEL = new ItemTool("copper_shovel", ItemTool.COPPER, ItemTool.SPADE_EFFECTIVE_ON, ToolTypes.SHOVEL); this allows me to have 1 class for all my tools, 1 class for all my armor, 1 class for all my normal items (ingots, nuggets etc.) and very few other classes
  11. yeah it is an odd way to do it, but it places all your registration logic in one file. Whats wrong with putting public Blah() { super(); this.setRegistryName(new ResourceLocation(Reference.ID, "blah")); this.setUnlocalizedName("blah"); } in every class?
  12. I don't know if this is what you were looking for but this is how I instantiate my items public class ModItems { public static final ItemFlamethrower FLAMETHROWER = new ItemFlamethrower("flamethrower"); public static final ItemHammer HAMMER = new ItemHammer("hammer"); public static final ItemRailgun RAILGUN = new ItemRailgun("railgun"); public static final ItemCoilgun COILGUN = new ItemCoilgun("coilgun"); public static final ItemPlasmagun PLASMA_GUN = new ItemPlasmagun("plasmagun"); public static final Item[] ITEMS = { FLAMETHROWER, HAMMER, RAILGUN, COILGUN, PLASMA_GUN }; }
  13. are you 100% sure you are running in Debug mode and not normal mode?
  14. This is a known bug, but I get it about 2/3 times I launch the Dedicated server (usually in Eclipse Workspace, usually in debug mode), thought that these screenshots might help Log
  15. 1.7.10 is no longer supported on this forum - Update to a more recent version for support heres a list of things to look at that may help you fix your problem, best of luck!
  16. Try removing the mod that calls tries to create the entity - the Ultimate Pun Mod
  17. itemstack.damageItem(maxDamage / clipSize, playerIn); what are you trying to do here??
  18. public abstract class ItemGun extends Item why abstract? public abstract void shoot(World worldIn, EntityPlayer playerIn, EnumHand handIn); why is it abstract and why doesn't it do anything?
  19. look at how ItemBow does it noticed that your already trying to do it the same way can you post a GitHub? your ItemGun class is rather hard to read Ignore this post
  20. also put registerRender in ModelRegistryEvent using Subscribe Events so that it gets called at the proper time
×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.