-
Posts
107 -
Joined
-
Last visited
Everything posted by tebreca
-
Dear minecraftforge forums, So, I was trying to add particles. But the EnumHelper doesn't seem to have any method to add particles. How do I add a particle, and how does one change a particle's texture without gl code? Thanks for taking a look
-
Do you have any good examples on the ICustomModelLoader & IBakedModel? EDIT: nvm i found out there were docs on it
-
allright thanks! ill take a look at it!
-
As far as im aware, blockstates are getting a complete remake in 1.13, also i forgot to say but i want it to be dynamic, so other mods can add their slab machines too, meaning that a PropertyEnum won't work as a enum should be final, or am i wrong?
-
Hello mcforge forums, It has been a while since i were online, Anyways, My mod has different kinds of slabs; generators, machines etc. I want to make it so you can place a generator and a machine in the same block, i figured that shouldn't be that hard. But i want to render them too, and because of 1.13 im not wanting to make blockstates and all that stuff. So i figured i would need to make a TESR to render everything. But how? Is there any way i can for example, Get both block's IBakedModels, and combine them into one and render it? Or anything else? Or do i need to make some image manipulation code, making a custom texture combining the two existing textures? Thanks, Ewan Arends (tebreca)
-
Alright my bad, i should've taken a deeper look into the UUID's Thanks! that will definetly help me. Im sorry but if you've seen my code you should've known that im using EntityLivingBase. I don't know what entity im cloning, neither am i going to check that as i would lose compatability with entities not inside my mod building workspace. And if i did call the constructor of it, i would make a EntityLivingBase object. Which i can't upcast to the original entity object type. Also EntityLivingBase is abstract. Thanks for trying to help me atleast. But please get your facts straight, i literally made a new object and was trying to pass the same NBT in it, that would affect the position but i could move it, as i did do and the other entity wouldn't move with it as its AI is created at the object-specific method for AI.
-
Dear mcforge forums, I recently started working on a machine that would clone an Entity, this is what ive got so far: if(entity != null) { NBTTagCompound data = entity.writeToNBT(new NBTTagCompound()); entity = EntityRegistry.instance().getEntry(entity.getClass()).newInstance(world); entity.readFromNBT(data); entity.setUniqueId(new UUID(entity.getUniqueID().getMostSignificantBits(), entity.getUniqueID().getLeastSignificantBits())); entity.setPositionAndUpdate(out.getX() + 0.5, out.getY(), out.getZ() + 0.5); if(!world.isRemote) world.spawnEntity(entity); } the whole Block: https://hastebin.com/enudoligay.java the block's base class: https://hastebin.com/ujoleladof.java but the problem is that i get this error in console: I tried adding a different UUID etc. i have debugged it but i couldn't find a way of cloning entities. Thanks, tebreca
-
[Solved] Compatability for the IItemHandler capability in slots.
tebreca replied to tebreca's topic in Modder Support
Thank you! i didn't find that one when i was searching. -
Hello there mcforge forums, So i was helping someone else with coding a custom machine working with the energy capability and saw that he used IInventory for his TE, i know that that shouldn't be used as its vanilla code and forge suggests to use the IItemHandler capability, so i rewrote the machine, now i only have a little bit of a problem as i wanted to make a container for it. But i needed an IInventory to add slots to the container. So i figured that i'd make a new instance of the slot and make it compatible with IItemHandler. Now here's my question: Wouldn't it be smart to add this standardly to the Slot class? That would save time for both me an you, i dont need to re-write this file again, and you aren't in need to explain why to use IItemHandler instead of IInventory as
-
for the people watching this with the same question heres what ive got @SideOnly(Side.CLIENT) @Override public net.minecraft.util.BlockRenderLayer getBlockLayer() { return BlockRenderLayer.TRANSLUCENT; } notice that this is kinda laggy for low end graphics cards This is better and less graphics card heavy, but it will write you rexture just to a full cube, meaning it not like glass anymore and you cant see trough the block @SideOnly(Side.CLIENT) @Override public net.minecraft.util.BlockRenderLayer getBlockLayer() { return BlockRenderLayer.CUTOUT_MIPPED; }
-
Hello, Im working on a block with fluids inside it, I made a model for it with glass so you can see what fluid is inside it, this is how it looks in the world and in my hand: My code for the model file { "textures": { "0": "eaglesess:machines/factory_table_side", "1": "eaglesess:machines/liquid_absorber_side", "2": "eaglesess:machines/wooden_casing", "3": "eaglesess:machines/liquid_absorber_top", "4": "eaglesess:machines/liquid_absorber_liquid" }, "elements": [ { "name": "Cube", "from": [ 15.0, 0.0, 0.0 ], "to": [ 16.0, 16.0, 15.0 ], "faces": { "north": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 16.0 ] }, "east": { "texture": "#1", "uv": [ 1.0, 0.0, 16.0, 16.0 ] }, "south": { "texture": "#0", "uv": [ 15.0, 0.0, 16.0, 16.0 ] }, "west": { "texture": "#1", "uv": [ 0.0, 0.0, 15.0, 16.0 ] }, "up": { "texture": "#2", "uv": [ 0.0, 0.0, 1.0, 15.0 ] }, "down": { "texture": "#2", "uv": [ 0.0, 0.0, 1.0, 15.0 ] } } }, { "name": "Cube", "from": [ 1.0, 0.0, 15.0 ], "to": [ 16.0, 16.0, 16.0 ], "faces": { "north": { "texture": "#2", "uv": [ 0.0, 0.0, 15.0, 16.0 ] }, "east": { "texture": "#1", "uv": [ 0.0, 0.0, 1.0, 16.0 ] }, "south": { "texture": "#0", "uv": [ 1.0, 0.0, 16.0, 16.0 ] }, "west": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 16.0 ] }, "up": { "texture": "#2", "uv": [ 0.0, 0.0, 15.0, 1.0 ] }, "down": { "texture": "#2", "uv": [ 16.0, 1.0, 0.0, 0.0 ] } } }, { "name": "Cube", "from": [ 0.0, 0.0, 0.0 ], "to": [ 15.0, 16.0, 1.0 ], "faces": { "north": { "texture": "#0", "uv": [ 1.0, 0.0, 16.0, 16.0 ] }, "east": { "texture": "#1", "uv": [ 15.0, 0.0, 16.0, 16.0 ] }, "south": { "texture": "#2", "uv": [ 0.0, 0.0, 15.0, 16.0 ] }, "west": { "texture": "#1", "uv": [ 1.0, 0.0, 0.0, 16.0 ] }, "up": { "texture": "#2", "uv": [ 16.0, 15.0, 2.0, 16.0 ] }, "down": { "texture": "#2", "uv": [ 1.0, 1.0, 15.0, 15.0 ] } } }, { "name": "Cube", "from": [ 0.0, 0.0, 1.0 ], "to": [ 1.0, 16.0, 16.0 ], "faces": { "north": { "texture": "#2", "uv": [ 0.0, 0.0, 1.0, 16.0 ] }, "east": { "texture": "#1", "uv": [ 0.0, 0.0, 15.0, 16.0 ] }, "south": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 16.0 ] }, "west": { "texture": "#1", "uv": [ 1.0, 0.0, 16.0, 16.0 ] }, "up": { "texture": "#3", "uv": [ 0.0, 1.0, 1.0, 16.0 ] }, "down": { "texture": "#2", "uv": [ 0.0, 0.0, 1.0, 15.0 ] } } }, { "name": "Bottom", "from": [ 1.0, 0.0, 1.0 ], "to": [ 15.0, 1.0, 15.0 ], "faces": { "north": { "texture": "#0", "uv": [ 0.0, 0.0, 14.0, 1.0 ] }, "east": { "texture": "#2", "uv": [ 0.0, 0.0, 14.0, 1.0 ] }, "south": { "texture": "#2", "uv": [ 0.0, 0.0, 16.0, -5.0 ] }, "west": { "texture": "#2", "uv": [ 0.0, 0.0, -13.0, -13.0 ] }, "up": { "texture": "#2", "uv": [ 1.0, 1.0, 15.0, 15.0 ] }, "down": { "texture": "#2", "uv": [ 1.0, 1.0, 15.0, 15.0 ] } } }, { "name": "Fluid", "from": [ 1.0, 1.0, 1.0 ], "to": [ 15.0, 15.0, 15.0 ], "faces": { "north": { "texture": "#4", "uv": [ 1.0, 1.0, 15.0, 15.0 ] }, "east": { "texture": "#4", "uv": [ 1.0, 1.0, 15.0, 15.0 ] }, "south": { "texture": "#4", "uv": [ 1.0, 1.0, 15.0, 15.0 ] }, "west": { "texture": "#4", "uv": [ 1.0, 1.0, 15.0, 15.0 ] }, "up": { "texture": "#4", "uv": [ 1.0, 1.0, 15.0, 15.0 ] }, "down": { "texture": "#4", "uv": [ 1.0, 1.0, 15.0, 15.0 ] } } }, { "name": "Top", "from": [ 1.0, 15.0, 1.0 ], "to": [ 15.0, 16.0, 15.0 ], "faces": { "north": { "texture": "#2", "uv": [ 0.0, 0.0, 14.0, 1.0 ] }, "east": { "texture": "#2", "uv": [ 0.0, 0.0, 14.0, 1.0 ] }, "south": { "texture": "#2", "uv": [ 0.0, 0.0, 14.0, 1.0 ] }, "west": { "texture": "#2", "uv": [ 0.0, 0.0, 14.0, 1.0 ] }, "up": { "texture": "#3", "uv": [ 1.0, 1.0, 15.0, 15.0 ] }, "down": { "texture": "#2", "uv": [ 1.0, 1.0, 15.0, 15.0 ] } } } ] } My Forge blockstate file: { "forge_marker": 1, "defaults": { "model": "eaglesess:liquid_collector" }, "variants": { "normal": [{}], "inventory": [{}] } } I added some methods to the block: public static BlockBase fluidcollector = new BlockBase("fluid_collector", Material.WOOD, Main.blocksTab, 1) { @Override public boolean isOpaqueCube(net.minecraft.block.state.IBlockState state) { return true; }; public boolean isFullCube(IBlockState state) { return false; } }; thx
-
look at the screenshot, The slug is marked red in the webbar
-
[1.11] @SubscribeEvents inside Block class not running
tebreca replied to MSpace-Dev's topic in Modder Support
Adding tile entities is simple, you just make a class extending TileEntity, then you register it on your server/common proxy, and you override the methods hastileentity and and createtileentity. registering is like this: GameRegistry.registerTileEntity(TileBlockBreaker.class, Vars.MOD_ID + ":tile_blockbreaker"); -
add the mod to your IDE, then you would be able to get the variable, but keep in mind that you set dependence to load after that mod otherwise it will crash
-
[1.12.2]Calling ItemStack array in casted tileentity crashes world
tebreca replied to tebreca's topic in Modder Support
ok, thx -
[1.12.2]Calling ItemStack array in casted tileentity crashes world
tebreca replied to tebreca's topic in Modder Support
i mean the refresh method, its the method which updates the block when clicked -
[1.12.2]Calling ItemStack array in casted tileentity crashes world
tebreca replied to tebreca's topic in Modder Support
stacktrace: Thread: Client thread Stacktrace: at btf.objects.blocks.tiles.TileAssembler.refresh(TileAssembler.java:22) at btf.util.handlers.MachineHandler.OnBlockActivated(MachineHandler.java:106) at btf.objects.blocks.Machine.onBlockActivated(Machine.java:142) at net.minecraft.client.multiplayer.PlayerControllerMP.processRightClickBlock(PlayerControllerMP.java:454) at net.minecraft.client.Minecraft.rightClickMouse(Minecraft.java:1674) at net.minecraft.client.Minecraft.processKeyBinds(Minecraft.java:2361) at net.minecraft.client.Minecraft.runTickKeyboard(Minecraft.java:2127) -- Affected level -- Details: Level name: MpServer All players: 1 total; [EntityPlayerSP['Player525'/331, l='MpServer', x=-175.22, y=75.00, z=260.58]] Chunk stats: MultiplayerChunkCache: 539, 539 Level seed: 0 Level generator: ID 00 - default, ver 1. Features enabled: false Level generator options: Level spawn location: World: (-172,64,256), Chunk: (at 4,4,0 in -11,16; contains blocks -176,0,256 to -161,255,271), Region: (-1,0; contains chunks -32,0 to -1,31, blocks -512,0,0 to -1,255,511) Level time: 36358 game time, 36358 day time Level dimension: 0 Level storage version: 0x00000 - Unknown? Level weather: Rain time: 0 (now: false), thunder time: 0 (now: false) Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: false Forced entities: 107 total; [EntitySkeleton['Skeleton'/65, l='MpServer', x=-244.50, y=29.00, z=192.50], EntityCow['Cow'/66, l='MpServer', x=-241.22, y=69.00, z=195.41], EntityCow['Cow'/67, l='MpServer', x=-251.03, y=66.00, z=213.58], EntityCow['Cow'/68, l='MpServer', x=-246.50, y=68.00, z=238.50], EntityWolf['Wolf'/69, l='MpServer', x=-239.70, y=68.00, z=239.38], EntityCow['Cow'/70, l='MpServer', x=-238.55, y=69.00, z=246.27], EntityCow['Cow'/71, l='MpServer', x=-253.79, y=72.00, z=330.56], EntityCow['Cow'/72, l='MpServer', x=-244.64, y=72.00, z=319.62], EntityPlayerSP['Player525'/331, l='MpServer', x=-175.22, y=75.00, z=260.58], EntityCow['Cow'/88, l='MpServer', x=-234.45, y=70.00, z=202.68], EntityCow['Cow'/89, l='MpServer', x=-237.16, y=67.00, z=220.17], EntityCow['Cow'/90, l='MpServer', x=-232.83, y=70.00, z=249.86], EntityCow['Cow'/91, l='MpServer', x=-239.82, y=69.00, z=267.63], EntityCow['Cow'/92, l='MpServer', x=-232.93, y=69.00, z=270.55], EntityCow['Cow'/93, l='MpServer', x=-229.60, y=70.00, z=284.50], EntityCow['Cow'/94, l='MpServer', x=-236.58, y=68.00, z=280.78], EntityCow['Cow'/95, l='MpServer', x=-227.20, y=70.00, z=298.14], EntityCow['Cow'/96, l='MpServer', x=-228.55, y=70.00, z=298.22], EntityWolf['Wolf'/97, l='MpServer', x=-234.00, y=68.00, z=295.77], EntityWolf['Wolf'/98, l='MpServer', x=-233.43, y=68.00, z=295.09], EntityZombie['Zombie'/106, l='MpServer', x=-215.50, y=21.00, z=236.50], EntityBat['Bat'/107, l='MpServer', x=-212.56, y=55.58, z=264.43], EntityCow['Cow'/108, l='MpServer', x=-221.20, y=70.00, z=263.83], EntitySkeleton['Skeleton'/109, l='MpServer', x=-210.50, y=53.00, z=274.50], EntityCow['Cow'/110, l='MpServer', x=-216.21, y=70.00, z=285.40], EntityCow['Cow'/111, l='MpServer', x=-212.44, y=70.00, z=283.26], EntityCow['Cow'/112, l='MpServer', x=-209.45, y=69.00, z=294.32], EntitySkeleton['Skeleton'/113, l='MpServer', x=-218.50, y=22.00, z=325.01], EntityZombie['Zombie'/114, l='MpServer', x=-215.50, y=39.00, z=339.50], EntityWolf['Wolf'/119, l='MpServer', x=-193.26, y=73.00, z=210.61], EntityCow['Cow'/120, l='MpServer', x=-196.50, y=74.00, z=202.72], EntityCow['Cow'/121, l='MpServer', x=-200.34, y=74.25, z=229.41], EntityWolf['Wolf'/122, l='MpServer', x=-197.60, y=71.00, z=237.27], EntitySkeleton['Skeleton'/123, l='MpServer', x=-192.50, y=28.00, z=260.50], EntitySpider['Spider'/124, l='MpServer', x=-204.03, y=31.00, z=260.65], EntityZombie['Zombie'/125, l='MpServer', x=-192.39, y=59.00, z=266.13], EntitySkeleton['Skeleton'/126, l='MpServer', x=-197.50, y=20.00, z=280.50], EntityZombie['Zombie'/127, l='MpServer', x=-197.31, y=18.00, z=275.74], EntityZombie['Zombie'/128, l='MpServer', x=-201.35, y=19.00, z=278.48], EntityBat['Bat'/129, l='MpServer', x=-195.03, y=21.48, z=275.17], EntityCow['Cow'/130, l='MpServer', x=-199.78, y=70.00, z=291.82], EntityCow['Cow'/131, l='MpServer', x=-199.61, y=70.00, z=301.21], EntityCow['Cow'/132, l='MpServer', x=-202.30, y=70.00, z=297.57], EntityCow['Cow'/133, l='MpServer', x=-198.87, y=70.00, z=298.87], EntitySkeleton['Skeleton'/134, l='MpServer', x=-195.50, y=16.00, z=305.50], EntitySkeleton['Skeleton'/135, l='MpServer', x=-193.49, y=16.00, z=305.78], EntityZombie['Zombie'/136, l='MpServer', x=-195.50, y=16.00, z=305.50], EntityCow['Cow'/139, l='MpServer', x=-180.22, y=72.00, z=204.85], EntityCow['Cow'/140, l='MpServer', x=-176.44, y=71.00, z=206.21], EntitySkeleton['Skeleton'/141, l='MpServer', x=-184.50, y=35.00, z=253.50], EntityCreeper['Creeper'/142, l='MpServer', x=-179.46, y=60.00, z=255.55], EntitySkeleton['Skeleton'/143, l='MpServer', x=-187.35, y=58.00, z=266.22], EntityBat['Bat'/144, l='MpServer', x=-182.75, y=64.10, z=258.25], EntityBat['Bat'/145, l='MpServer', x=-185.27, y=55.10, z=281.59], EntityCreeper['Creeper'/146, l='MpServer', x=-184.52, y=52.00, z=282.97], EntityBat['Bat'/147, l='MpServer', x=-184.30, y=54.10, z=281.66], EntityZombie['Zombie'/148, l='MpServer', x=-177.77, y=56.00, z=278.50], EntityItem['item.item.dyePowder.black'/149, l='MpServer', x=-186.82, y=47.00, z=292.89], EntityBat['Bat'/150, l='MpServer', x=-190.36, y=19.27, z=311.34], EntityCow['Cow'/153, l='MpServer', x=-174.50, y=67.00, z=195.21], EntityBat['Bat'/154, l='MpServer', x=-167.30, y=58.10, z=243.57], EntityCreeper['Creeper'/155, l='MpServer', x=-172.45, y=62.00, z=251.85], EntitySpider['Spider'/156, l='MpServer', x=-168.21, y=62.00, z=246.74], EntityZombie['Zombie'/157, l='MpServer', x=-163.50, y=26.00, z=270.50], EntitySkeleton['Skeleton'/158, l='MpServer', x=-163.50, y=35.00, z=265.50], EntityCreeper['Creeper'/159, l='MpServer', x=-164.50, y=35.00, z=267.50], EntityBat['Bat'/160, l='MpServer', x=-171.25, y=59.10, z=269.75], EntityWitch['Witch'/161, l='MpServer', x=-173.73, y=61.00, z=256.46], EntityItem['item.item.carrots'/162, l='MpServer', x=-175.50, y=74.00, z=256.50], EntitySkeleton['Skeleton'/163, l='MpServer', x=-166.50, y=19.00, z=285.50], EntityZombie['Zombie'/164, l='MpServer', x=-163.70, y=33.00, z=278.50], EntityBat['Bat'/165, l='MpServer', x=-174.25, y=61.10, z=282.25], EntityBat['Bat'/166, l='MpServer', x=-167.23, y=56.10, z=280.99], EntitySpider['Spider'/167, l='MpServer', x=-174.70, y=59.00, z=281.60], EntitySkeleton['Skeleton'/168, l='MpServer', x=-160.50, y=54.00, z=287.50], EntitySkeleton['Skeleton'/169, l='MpServer', x=-170.70, y=58.00, z=277.70], EntityBat['Bat'/170, l='MpServer', x=-165.14, y=53.09, z=285.49], EntitySkeleton['Skeleton'/171, l='MpServer', x=-175.50, y=18.00, z=313.50], EntitySpider['Spider'/179, l='MpServer', x=-155.50, y=32.00, z=203.50], EntityBat['Bat'/181, l='MpServer', x=-144.25, y=33.10, z=231.75], EntitySkeleton['Skeleton'/182, l='MpServer', x=-156.50, y=45.00, z=241.50], EntityZombie['Zombie'/183, l='MpServer', x=-149.57, y=15.00, z=259.25], EntityWitch['Witch'/184, l='MpServer', x=-165.93, y=39.00, z=287.50], EntityZombie['Zombie'/185, l='MpServer', x=-158.50, y=34.00, z=285.19], EntitySkeleton['Skeleton'/186, l='MpServer', x=-159.50, y=54.00, z=285.50], EntityCreeper['Creeper'/187, l='MpServer', x=-148.18, y=16.00, z=288.51], EntitySkeleton['Skeleton'/188, l='MpServer', x=-155.50, y=47.00, z=334.50], EntityZombie['Zombie'/189, l='MpServer', x=-157.07, y=47.00, z=330.22], EntityZombie['Zombie'/190, l='MpServer', x=-153.50, y=46.00, z=327.50], EntitySkeleton['Skeleton'/191, l='MpServer', x=-157.31, y=29.00, z=340.56], EntityChicken['Chicken'/200, l='MpServer', x=-133.12, y=82.00, z=183.49], EntityMinecartChest['Minecart with Chest'/201, l='MpServer', x=-138.50, y=31.06, z=236.50], EntityBat['Bat'/202, l='MpServer', x=-140.57, y=33.10, z=229.25], EntitySkeleton['Skeleton'/203, l='MpServer', x=-142.49, y=35.00, z=246.33], EntityCreeper['Creeper'/204, l='MpServer', x=-130.60, y=24.00, z=266.85], EntityBat['Bat'/205, l='MpServer', x=-134.10, y=18.16, z=261.58], EntityWolf['Wolf'/206, l='MpServer', x=-138.50, y=74.00, z=256.17], EntitySkeleton['Skeleton'/207, l='MpServer', x=-137.74, y=25.00, z=285.56], EntityChicken['Chicken'/222, l='MpServer', x=-122.59, y=88.00, z=188.53], EntityChicken['Chicken'/225, l='MpServer', x=-114.61, y=90.00, z=192.14], EntitySkeleton['Skeleton'/226, l='MpServer', x=-116.50, y=22.00, z=227.50], EntitySkeleton['Skeleton'/227, l='MpServer', x=-122.49, y=24.00, z=233.18], EntityBat['Bat'/228, l='MpServer', x=-119.44, y=13.10, z=253.81], EntityZombie['Zombie'/240, l='MpServer', x=-110.24, y=41.00, z=198.50], EntitySkeleton['Skeleton'/241, l='MpServer', x=-97.58, y=49.00, z=219.07], EntityZombie['Zombie'/242, l='MpServer', x=-102.73, y=32.00, z=238.52], EntityZombieVillager['Zombie Villager'/243, l='MpServer', x=-100.22, y=51.00, z=310.52]] Retry entities: 0 total; [] Server brand: fml,forge Server type: Integrated singleplayer server Stacktrace: at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:461) at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2879) at net.minecraft.client.Minecraft.run(Minecraft.java:465) at net.minecraft.client.main.Main.main(Main.java:118) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) at GradleStart.main(GradleStart.java:26) exeption: java.lang.NullPointerException: null at btf.objects.blocks.tiles.TileAssembler.refresh(TileAssembler.java:22) ~[TileAssembler.class:?] at btf.util.handlers.MachineHandler.OnBlockActivated(MachineHandler.java:106) ~[MachineHandler.class:?] at btf.objects.blocks.Machine.onBlockActivated(Machine.java:142) ~[Machine.class:?] at net.minecraft.client.multiplayer.PlayerControllerMP.processRightClickBlock(PlayerControllerMP.java:454) ~[PlayerControllerMP.class:?] at net.minecraft.client.Minecraft.rightClickMouse(Minecraft.java:1674) ~[Minecraft.class:?] at net.minecraft.client.Minecraft.processKeyBinds(Minecraft.java:2361) ~[Minecraft.class:?] at net.minecraft.client.Minecraft.runTickKeyboard(Minecraft.java:2127) ~[Minecraft.class:?] at net.minecraft.client.Minecraft.runTick(Minecraft.java:1915) ~[Minecraft.class:?] at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1171) ~[Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:436) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_151] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_151] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_151] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_151] at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_151] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_151] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_151] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_151] at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?] at GradleStart.main(GradleStart.java:26) [start/:?] -
[1.12.2]Calling ItemStack array in casted tileentity crashes world
tebreca replied to tebreca's topic in Modder Support
im sorry i meant update method, (morning brain) -
So hello everybody, i was trying to make a tile entity for a machine that would onky accept items in special slots, but when it calls the update statement, i instantly get a exeption, i tried to debug but i didn't found anything. Do i send packets in the wrong way? code for TE: package btf.objects.blocks.tiles; import btf.init.BlockInit; import btf.init.ItemInit; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; public class TileAssembler extends TileEntity{ public ItemStack[] inv = new ItemStack[3]; public ItemStack getInv(int meta) { return this.inv[meta]; } public void setInv(ItemStack inv, int meta) { this.inv[meta] = inv; } public void refresh() { if(inv[0].getItem()==Items.DIAMOND_HOE&&inv[1].getItem()==ItemInit.copperGear) { if(world.getBlockState(pos.add(0, 1, 0)).getBlock()==BlockInit.casingWooden) { world.setBlockState(pos.add(0, 1, 0), BlockInit.harvester.getDefaultState()); inv[0]=null;inv[1]=null; } } else if (inv[2].getItem()==Items.DIAMOND_PICKAXE&&inv[3].getItem()==ItemInit.ironGear) { if(world.getBlockState(pos.add(0, 1, 0)).getBlock()==BlockInit.casingWooden) { world.setBlockState(pos.add(0, 1, 0), BlockInit.blockbreaker.getDefaultState()); inv[2]=null;inv[3]=null; } } } @Override public NBTTagCompound writeToNBT(NBTTagCompound compound) { // TODO Auto-generated method stub return super.writeToNBT(compound); } @Override public void readFromNBT(NBTTagCompound compound) { // TODO Auto-generated method stub super.readFromNBT(compound); } } Block code: package btf.objects.blocks; import btf.main.Main; import btf.objects.blocks.tiles.TileAssembler; import btf.objects.blocks.tiles.TileBlockBreaker; import btf.objects.blocks.tiles.TileCrafterMachine; import btf.objects.blocks.tiles.TileHarvesterTicker; import btf.util.handlers.MachineHandler; import btf.util.handlers.MachineHandler.MachineTypes; import net.minecraft.block.BlockRedstoneWire; import net.minecraft.block.ITileEntityProvider; import net.minecraft.block.material.Material; import net.minecraft.block.properties.PropertyDirection; import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.MoverType; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; public class Machine extends BlockBase implements ITileEntityProvider{ public static final PropertyDirection FACING = PropertyDirection.create("facing"); MachineTypes typeIn; public Machine(String name, Material materialIn, CreativeTabs tab, MachineTypes machinetype) { super(name, materialIn, tab); typeIn=machinetype; this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH)); } @Deprecated public Machine(String name, Material materialIn, CreativeTabs tab) { //EXTREMELY DEPRECATED use (String name, Material materialIn, CreativeTabs tab, MachineTypes machinetype) instead super(name, materialIn, tab); Main.LOGGER.warn("Registering Machines Without a MACHINETYPE!! this is ABSOLUTELY Deprecated"); } @Override public boolean canConnectRedstone(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side) { switch (typeIn) { case FACTORYTABLE: { if(side == side.EAST || side == side.WEST || side == side.NORTH || side == side.SOUTH) return true; return false; } case BLOCKBREAKER: { if (side == side.DOWN) return true; return false; } case HARVESTER: { if (side == side.DOWN) return true; return false; } case TELEPORTER: { return false; } case WOODENCASING: { return false; } case ASSEMBLER: { return false; } } return false; } @Override public TileEntity createTileEntity(World world, IBlockState state) { switch (typeIn) { case WOODENCASING: { //TODO Add TileEntity break; } case BLOCKBREAKER: { return new TileBlockBreaker(); } case FACTORYTABLE: { return new TileCrafterMachine(); } case HARVESTER: { return new TileHarvesterTicker(); } case TELEPORTER: { //TODO Add TileEntity break; } case ASSEMBLER: { return new TileAssembler(); } } return super.createTileEntity(world, state); } @Override public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) { if (this.typeIn == MachineTypes.HARVESTER||this.typeIn == MachineTypes.BLOCKBREAKER) { worldIn.setBlockState(pos, this.getBlockState().getBaseState().withProperty(FACING, placer.getHorizontalFacing().getOpposite())); } super.onBlockPlacedBy(worldIn, pos, state, placer, stack); } @Override protected BlockStateContainer createBlockState() { return new BlockStateContainer(this, FACING); } @Override public int getMetaFromState(IBlockState state) { return state.getValue(FACING).getIndex(); } @Override public IBlockState getStateFromMeta(int meta) { return this.getDefaultState().withProperty(FACING, EnumFacing.getFront(meta & 7)); } @Override public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { MachineHandler.OnBlockActivated(worldIn, pos, state, playerIn, hand, typeIn); return super.onBlockActivated(worldIn, pos, state, playerIn, hand, facing, hitX, hitY, hitZ); } @Override public TileEntity createNewTileEntity(World worldIn, int meta) { if (typeIn == MachineTypes.BLOCKBREAKER) return new TileBlockBreaker(); if (typeIn == MachineTypes.HARVESTER) return new TileHarvesterTicker(); if (typeIn == MachineTypes.ASSEMBLER) return new TileAssembler(); return null; } } the machinehandler handling the onclick event: package btf.util.handlers; import java.util.Map; import java.util.Random; import btf.init.ItemInit; import btf.main.Main; import btf.objects.blocks.Machine; import btf.objects.blocks.tiles.TileAssembler; import btf.objects.blocks.tiles.TileCrafterMachine; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.MoverType; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public class MachineHandler { public static enum MachineTypes { BLOCKBREAKER, FACTORYTABLE, HARVESTER, TELEPORTER, WOODENCASING, ASSEMBLER } private boolean initialized = false; private BlockPos breaking; private int dropx; private int dropy; private int dropz; public static void OnBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, MachineTypes typeIn) { switch (typeIn) { case WOODENCASING: { break; } case BLOCKBREAKER: { break; } case FACTORYTABLE: { if (playerIn.getActiveItemStack().getItem() == Items.DIAMOND_HOE) { //null } break; } case HARVESTER: { break; } case TELEPORTER: { if (!playerIn.isSneaking()) { BlockPos posNew = new BlockPos(pos.getX(), pos.getY()+1, pos.getZ()); if(worldIn.getBlockState(posNew) == Blocks.AIR.getDefaultState()) { BlockPos playerPos = playerIn.getPosition().add(0, -1, 0); if (worldIn.getBlockState(playerPos) == state) playerIn.move(MoverType.SELF, 0, 1.0, 0); worldIn.setBlockToAir(pos); worldIn.setBlockState(posNew, state); } }else { BlockPos posNew = new BlockPos(pos.getX(), pos.getY()-1, pos.getZ()); if(worldIn.getBlockState(posNew) == Blocks.AIR.getDefaultState()) { worldIn.setBlockToAir(pos); worldIn.setBlockState(posNew, state); } } } case ASSEMBLER: { ItemStack inv; inv = playerIn.getActiveItemStack().copy(); inv.setCount(1); int meta=0; ItemStack[] acceptedItems = new ItemStack[] { new ItemStack(Items.DIAMOND_HOE), new ItemStack(ItemInit.copperGear), new ItemStack(Items.DIAMOND_PICKAXE), new ItemStack(ItemInit.ironGear) }; for ( ItemStack invcheck:acceptedItems) { meta++; if(invcheck.getItem() == inv.getItem()) { TileEntity TileentityIn = worldIn.getTileEntity(pos); if(TileentityIn instanceof TileAssembler) { TileAssembler tileIn = (TileAssembler)TileentityIn; tileIn.setInv(inv, meta); playerIn.getActiveItemStack().shrink(1); } } } TileEntity TileentityIn = worldIn.getTileEntity(pos); if(TileentityIn instanceof TileAssembler) { TileAssembler tileIn = (TileAssembler)worldIn.getTileEntity(pos); tileIn.refresh(); } } break; } } }
-
J9.0.1, newest, im sorry for you, ill keep it at the newest java 8 JDK
-
ok thx, ill downgrade then