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

jredfox

Members
  • Posts

    660
  • Joined

  • Last visited

Everything posted by jredfox

  1. problem is already solved. I was generating files when the boolean was eclipse yet the mod was compiled meaning it had all the files generated inside of the jar already. The files that were generating before looking for compiled were src/main/resources/modid/files
  2. only if the mod isn't compiled. Because if it's a jar file it means that the jsons and lang are already inside of the jar file and the assets are already loaded
  3. that's what I was doing to begin with but, other mods that were jar files were generating files in src/main/resources because it was eclipse
  4. but, I have multiple mods that would do this. So your saying create my own config between mod and boolean? I guess I could do that just was hoping that the mod container already had something
  5. that seems like alot of work for every time I compile a mod. is there no other way?
  6. I need a boolean to know if a mod in my mdk is compiled that way it doesn't generate files automatically that it doesn't do in compiled form. Because checking if it is eclipse isn't enough I load the mod and it generates the files when it's already compiled.
  7. I eventually figured out there is a third tile entity setting into the client world only if the player places it using the offhand. It could be related to these packets always being sent twice this.player.connection.sendPacket(new SPacketBlockChange(worldserver, blockpos)); this.player.connection.sendPacket(new SPacketBlockChange(worldserver, blockpos.offset(enumfacing)));
  8. so what is the difference between client and server sync when you use the offhand. I debugged another 8 hours looked at 30+ more classes and can't figure out why it's rendering a pig. My best guess is something is setting the block state wrong or tile entity if and only if it's your offhand. please help.
  9. So after 2 hours of solid debugging again at a random chance I think I found the answer but, no solution. If the tileentity is placed from the offhand something is replacing it with another tile entity as if it had gotten deleted. System.out.println(ItemBlock.lastTile == Minecraft.getMinecraft().world.getTileEntity(ItemBlock.lastTile.getPos())); Output: false that means the memory location isn't the same as the tile entity last placed. What do I do why is this happening what is happening post placement logic only happening when you place it in the offhand that is causing this? I also tested in the main hand the same thing occurred there were two tile entities at the same pos the only difference being is one is pig. What packets that are sent from the server send tile entities because it's sending the wrong data somehow? For the actual issue of why it's sending a pig spawner as the 2d tile entity in the same block is unkown to me.
  10. Ok well whatever forge uses to get private values I will just have to re-write my ReflectionUtil to match forge's even if it's an access transformer. Thanks.
  11. for example the itemstack.stackSize cannot be directly set you cannot say itemstack.stackSize += 10; ... there are also alot of private fields that cannot be set nor gotten related to the minecraft class. IItemRenderer port will no longer work since it uses reflection to set an object. Many many things will break there has to be a way to allow reflection
  12. I thought reflection was still in java 9+? do you have to use nodes instead to set stuff? Without reflection you can't even correctly set the itemstacks size without a loop. And all the methods that should be public that I invoke
  13. the code fires on both sides client and server since I don't stop it. I copied it from 1.8 and then modified it slightly and added the ability for events to fire which just by itself does 1.8 code. Spawners can now render random entities onInitialSpawn() during the spawner to ignore the next readFromNBT() sent by the server after the initial client one. On the main hand it works on the offhand it does not. if 1.8 code had onInitialSpawn() twice it would flash two different entity models usually for horses as an example. I also confirmed the result is successful during the readFromNBT(),setTileNBT() and the useItem() fired twice so what am I missing here? Could you give me some idea of some classes that could have something else to do with post placement? I need more debugging but, I would assume A: it's not rendering updating or B: there is something resetting the mob spawner immediately after my placement A quickfix would be to let the models flash twice or simply don't render until the server gets data. But, this would be an issue with other things like signs rendering wrong and flashing text and mods would look way worse imagine AE2 placement between red and blue or something.
  14. will it have java 8 compatibility as well? What is the difference that java 9 has changed no ASM or something, no Annotations because that's all I could think of. I remember reading the major changes and all that happened was new things called nodes or something?
  15. the issue with nbt is you need a hasTagsMethod() well NBTTagCompounds could be inside of NBTTagCompounds and inside of that a tag list with another NBTTagCompound and inside of that you get it. So you need a method for deep comparison then you go how do you compare all tags with .equals() <= >= or simply tag.equals(tag). If your looking for tag.equals(tag) it's very simply to make but, the issue with this is your recipes will break if any other tag is added. now if you want to simply know if it contains tags you need a deep comparison for the nbt. I used to have an api for this but, it didn't use recursion so I am going to re-write it. So your options are write an api, use an api, or make an IRecipe which literally checks for tag.equals(tag) which will fail if any other data is there if you only wanted specific tags and not a deep comparison then you can simply make your own implementation of IRecipe which doesn't check for everything only the things you are going to be checking. The issue with that is you need one IRecipe class per implementation rather then one for everything.
  16. so does anybody know why mc thinks that it's resetting the tile entity to a pig right after it renders properly for a tick?
  17. you can return hardness based upon the blockstate. so for example your initial hardness is 1.0F for your dirt ore. Your diamond ore would be your hardness + 3.0F. Check the blockstate then do something with it.
  18. Looking for Event when Player logs out or leaves server on client side? After that I want to clear my client side only data that gets stored when the server sends it such as game seeds and other junk that was attached to that world. PlayerLoggedOutEvent is server only I think. I don't know about packets because they are on a separate thread and the player/connection might already be terminated when all my data is in a static hashmap. What should I do?
  19. So after debuging for hours it appears that there was a problem with the PacketSeed therefore somehow it was reverting the data even though the seed was wrong it should have still displayed. Forge network is weird throw an error don't just revert objects somehow someway.
  20. Goal: let the client request seed via a packet. Issue: I don't see a way possible to send a reply directly. I need to interact with the world to get the seed but, that has to be a separate thread so I can't return the IMessage. That leaves manually calling sending the packet when it get's processed well the issue with that is that's the first thing I tried and it didn't send a packet. I made a packet for: PacketSeed PacketSeedHandler PacketRequestSeed PacketRequestSeedHandler https://github.com/jredfox/evilnotchlib/tree/master/src/main/java/com/EvilNotch/lib/minecraft/network/packets event to put the seed in f3 which should make the server send the seed: @SubscribeEvent public void seedText(RenderGameOverlayEvent.Text e) { Minecraft mc = Minecraft.getMinecraft(); if(e.getType() != ElementType.TEXT || !mc.gameSettings.showDebugInfo) return; List<String> f3 = e.getLeft(); int index = 0; for(String s : f3) { if(s.toLowerCase().contains("biome")) { f3.add(index+1, "Seed:" + ClientProxy.getSeed(mc.world)); break; } index++; } } Client proxy: public static HashMap<Integer,String> seeds = new HashMap(); public static String getSeed(WorldClient world) { int dim = world.provider.getDimension(); if(!ClientProxy.seeds.containsKey(dim)) { ClientProxy.seeds.put(dim,"pending..."); NetWorkHandler.INSTANCE.sendToServer(new PacketRequestSeed(dim)); } return ClientProxy.seeds.get(dim); } output:"Seed:pending..."
  21. Fixed the server was sending the wrong blockstate packets when the main hand failed to place the block thus resetting any additional tile entity data thrown. Evil Notch Lib snasphot 65 fixes this I am replacing the method of ItemBlock class successfully with correct output as this is what gets replaced tested with decompile the bytes I returned and deobfuscated. That being said here is the code it works just fine in the main hand but, when you have the offhand it no longer works. The code should all be the same with the exception of my custom forge events which I don't implement. I don't have any if statements for the hand. Issue: renders horse for 1 tick then goes back to being a pig. The tile entity readFromNBT() specifically states that it is horse at the time. If go out and come back it renders the horse right Expected Result: it stay as horse spawner. Steps to reproduce: /give @p mob_spawner 1 0 {BlockEntityTag:{SpawnData:{id:horse},Delay:10000 }} you can printline and observe it did in fact readFromNBT() but, for some reason next tick it decides to go pig. If you printlined you noticed it fired once on both client and server like normal yet no updates. Something is resetting my mob spawner to pig from horse. public static boolean setTileEntityNBT(World worldIn, @Nullable EntityPlayer player, BlockPos pos, ItemStack stackIn) { NBTTagCompound stack = stackIn.getSubCompound("BlockEntityTag"); return setTileNBT(worldIn,player,pos,stackIn,stack,true); } public static boolean setTileNBT(World worldIn, @Nullable EntityPlayer player, BlockPos pos, ItemStack stackIn,NBTTagCompound stack,boolean blockData) { if (stack != null) { stack = stack.copy();//prevents this from being modified on the itemstack's nbt when firing the pre event TileEntity tileentity = worldIn.getTileEntity(pos); if (tileentity != null) { TileStackSyncEvent.Permissions permissions = new TileStackSyncEvent.Permissions(stackIn,pos,tileentity,player,worldIn,blockData); MinecraftForge.EVENT_BUS.post(permissions); //allow mods to override the tile entity ops only as well as player can use command if (permissions.opsOnly && !permissions.canUseCommand) { return false; } NBTTagCompound tileData = tileentity.writeToNBT(new NBTTagCompound()); NBTTagCompound copyTile = tileData.copy(); TileStackSyncEvent.Pre mergeEvent = new TileStackSyncEvent.Pre(stackIn,pos,tileentity,player,worldIn,blockData,tileData,stack); MinecraftForge.EVENT_BUS.post(mergeEvent); tileData = mergeEvent.tileData; stack = mergeEvent.nbt; tileData.merge(stack); tileData.setInteger("x", pos.getX()); tileData.setInteger("y", pos.getY()); tileData.setInteger("z", pos.getZ()); if (!tileData.equals(copyTile)) { tileentity.readFromNBT(tileData); tileentity.markDirty(); IBlockState state = worldIn.getBlockState(pos); worldIn.notifyBlockUpdate(pos, state.getBlock().getDefaultState(), state, 3); if(tileentity instanceof TileEntityMobSpawner && !stack.hasKey("SpawnPotentials")) { TileEntityMobSpawner spawner = (TileEntityMobSpawner)tileentity; if(worldIn.isRemote) System.out.println("readingFromNBT:" + (spawner.getSpawnerBaseLogic().getCachedEntity().getClass().getName()) ); List list = (List) ReflectionUtil.getObject(spawner.getSpawnerBaseLogic(), MobSpawnerBaseLogic.class, FieldAcess.potentialSpawns); list.clear(); } TileStackSyncEvent.Post event = new TileStackSyncEvent.Post(stackIn,pos,tileentity,player,worldIn,blockData); MinecraftForge.EVENT_BUS.post(event); if(worldIn.isRemote) SPacketUpdateTileEntity.toIgnore.add(pos); return true; } } } return false; } I tested this using a spawner. Now my code says to ignore the next readFromNBT() packet on the client side because it already read it from nbt once. My question to you is why is it still pig in only the offhand? Packet Method re-written: /** * Passes this Packet on to the NetHandler for processing. */ public void processPacket(INetHandlerPlayClient handler) { if(this.toIgnore.contains(this.blockPos)) { //System.out.println("Ignoring packet for tile:" + this.blockPos); this.toIgnore.remove(this.blockPos); return; } handler.handleUpdateTileEntity(this); } If necessary to prove no other asm is causing this I am willing to setup a new workspace.
  22. I think it fixed the issue but, I don't know for sure since it never gave me the same error when I went offline again.
×
×
  • Create New...

Important Information

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