Jump to content

Erfurt

Members
  • Posts

    249
  • Joined

  • Last visited

Everything posted by Erfurt

  1. Oh wow, that's some complicated stuff, personally I thought it would be somewhat simple to do, clearly I was wrong
  2. Actually, that didn't help me much, could you maybe give me an example of the code in use? So far I have this. LootEntry loot = new LootEntry(0, 0, null, "new_loot") { //null should be a LootCondition[] can't figure out how to do that @Override protected void serialize(JsonObject json, JsonSerializationContext context) {} @Override public void addLoot(Collection<ItemStack> stacks, Random rand, LootContext context) { //I guess this is where items/blocks go? } }; @SubscribeEvent public void addedDrops(LootTableLoadEvent event, EntityMob entity) { if (entity instanceof EntityZombie) { event.getTable().getPool("loot_table").addEntry(loot); } } I pretty sure this isn't the correct way to do this.
  3. Do you know in what vanilla class I can find this, just so that I have something to refer to? Never mind, I'm retarded
  4. Hey guys, So this is a multipart question. Firstly, as the title says, I want to know how I would go about adding player specific drops from mobs. I have this code for adding my stuff to the drops, I'm not sure if this is player specific or not. if (event.getEntity() instanceof EntityZombie) { ItemStack[] stack = new ItemStack[]{new ItemStack('item/block')}; for(int i = 0 ; i < stack.length ; i++) { EntityItem drop = new EntityItem(event.getEntity().worldObj, event.getEntity().posX, event.getEntity().posY, event.getEntity().posZ, stack[i]); event.getDrops().add(drop); } } Secondly I would like to know how to add items/blocks to dungeon chests, and/or fishing. I have no idea how to do this, and I don't know where to look for it in vanilla code. So any help here would be lovely That was it, hope you guys know what I'm talking about, and can help me.
  5. Ah okay, thanks. Do I need to have the mod, in this case Baubles, installed in my environment, to check if my stuff will work, or should I be able to see all the stuff that bauble adds without doing any other stuff? Also if I was to add a library from a repository, how would I go about adding the appropriate entries to my build.gradle file? Not that I really need to know that right now, but I'd like to know
  6. Okay, so just to be sure. I need to put the Baubles API into this folder "my project"\build\sources\api\java, or am I wrong? I really don't want to do something wrong, and screw it up
  7. Hey guys, I was wondering if some of you know how to add an API like Baubles, to my mod? I have been searching on google, but have only been able to find some old forum post about it, which I found to be a bit confusing. A link to a 'guide' or some instructions would be very much appreciated
  8. Yes it is I had to remove this code from my EntityMountableBlock class, not really sure why, but that fixed my issue @Override public void onEntityUpdate() { if (!this.worldObj.isRemote) { if (this.isBeingRidden() || this.worldObj.isAirBlock(new BlockPos(blockPosX, blockPosY, blockPosZ))) { this.setDead(); worldObj.updateComparatorOutputLevel(getPosition(), worldObj.getBlockState(getPosition()).getBlock()); } } }
  9. Here's my new class. But if you are going to make something that is more or less the same as a torch, I would try and extend BlockTorch, I would have done it with this class, but as I mentioned I couldn't get it to work the way I wanted it to work, so that's why I have used some code from the BlockTorch in my class.
  10. Sure, I post it here when I get home from work in a couple of hours
  11. Hey guys just a little update here. I have made it work with PropertyDirection, and I ended up using some code from BlockTorch, I have been trying to extend BlockTorch. But for some reason that didn't work. But nonetheless it's working now.
  12. Cool, I will give it a try, and post here if I get problems
  13. Hey guys just a quick question. I have decided to rewrite this class, as there was some things that I didn't like. I am planning on using a PropertyDirection, instead of all the PropertyBools I have currently, but I want to know if I can use one for all 6 sides? I know that it's most commonly used to get the horizontal sides, but I would need to get the up and down sides as well.
  14. Because I was derping around when I made that thing. And I actually thought that air would return null, but you learn every day
  15. As I mentioned in the OP, I'm trying to get the check in the canConnectTo method, not really sure why that other guy wanted the that code and crash report. and that code was mostly from memory, as it was just for some testing stuff
  16. This was the code that I had inside the getActualState method. IBlockState block_north = worldIn.getBlockState(pos.north()); IBlockState block_east = worldIn.getBlockState(pos.east()); IBlockState block_south = worldIn.getBlockState(pos.south()); IBlockState block_west = worldIn.getBlockState(pos.west()); if(!(block_north.getBlock() == null)) { if(block_above.getValue(BlockStairs.FACING) == EnumFacing.SOUTH) { state = state.withProperty(NORTH, true); } } if(!(block_east.getBlock() == null)) { if(block_east.getValue(BlockStairs.FACING) == EnumFacing.WEST) { state = state.withProperty(EAST, true); } } if(!(block_south.getBlock() == null)) { if(block_south.getValue(BlockStairs.FACING) == EnumFacing.NORTH) { state = state.withProperty(SOUTH, true); } } if(!(block_west.getBlock() == null)) { if(block_west.getValue(BlockStairs.FACING) == EnumFacing.EAST) { state = state.withProperty(WEST, true); } } Here's the crash-report ---- Minecraft Crash Report ---- // You should try our sister game, Minceraft! Time: 03-02-17 18:48 Description: Unexpected error java.lang.IllegalArgumentException: Cannot get property PropertyDirection{name=facing, clazz=class net.minecraft.util.EnumFacing, values=[north, south, west, east]} as it does not exist in BlockStateContainer{block=minecraft:air, properties=[]} at net.minecraft.block.state.BlockStateContainer$StateImplementation.getValue(BlockStateContainer.java:196) at erfurt.walls.blocks.LanternBlock.getActualState(LanternBlock.java:114) at net.minecraft.block.state.BlockStateContainer$StateImplementation.getActualState(BlockStateContainer.java:416) at net.minecraft.client.gui.GuiOverlayDebug.getDebugInfoRight(GuiOverlayDebug.java:207) at net.minecraftforge.client.GuiIngameForge$GuiOverlayDebugForge.getRight(GuiIngameForge.java:913) at net.minecraftforge.client.GuiIngameForge$GuiOverlayDebugForge.access$200(GuiIngameForge.java:895) at net.minecraftforge.client.GuiIngameForge.renderHUDText(GuiIngameForge.java:689) at net.minecraftforge.client.GuiIngameForge.renderGameOverlay(GuiIngameForge.java:171) at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1125) at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1139) at net.minecraft.client.Minecraft.run(Minecraft.java:406) 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) A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Thread: Client thread Stacktrace: at net.minecraft.block.state.BlockStateContainer$StateImplementation.getValue(BlockStateContainer.java:196) at erfurt.walls.blocks.LanternBlock.getActualState(LanternBlock.java:114) at net.minecraft.block.state.BlockStateContainer$StateImplementation.getActualState(BlockStateContainer.java:416) at net.minecraft.client.gui.GuiOverlayDebug.getDebugInfoRight(GuiOverlayDebug.java:207) at net.minecraftforge.client.GuiIngameForge$GuiOverlayDebugForge.getRight(GuiIngameForge.java:913) at net.minecraftforge.client.GuiIngameForge$GuiOverlayDebugForge.access$200(GuiIngameForge.java:895) at net.minecraftforge.client.GuiIngameForge.renderHUDText(GuiIngameForge.java:689) at net.minecraftforge.client.GuiIngameForge.renderGameOverlay(GuiIngameForge.java:171) -- Affected level -- Details: Level name: MpServer All players: 1 total; [EntityPlayerSP['Player438'/221, l='MpServer', x=-32,82, y=72,06, z=231,41]] Chunk stats: MultiplayerChunkCache: 620, 620 Level seed: 0 Level generator: ID 00 - default, ver 1. Features enabled: false Level generator options: Level spawn location: World: (-14,64,207), Chunk: (at 2,4,15 in -1,12; contains blocks -16,0,192 to -1,255,207), Region: (-1,0; contains chunks -32,0 to -1,31, blocks -512,0,0 to -1,255,511) Level time: 340921 game time, 1000 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: 111 total; [EntityPlayerSP['Player438'/221, l='MpServer', x=-32,82, y=72,06, z=231,41], EntitySkeleton['Skeleton'/56, l='MpServer', x=-103,44, y=32,00, z=178,28], EntityZombie['Zombie'/57, l='MpServer', x=-104,19, y=32,00, z=179,51], EntityCow['Cow'/58, l='MpServer', x=-96,85, y=72,00, z=209,59], EntitySheep['Sheep'/59, l='MpServer', x=-100,21, y=71,00, z=216,52], EntityChicken['Chicken'/60, l='MpServer', x=-108,85, y=70,00, z=223,41], EntitySheep['Sheep'/61, l='MpServer', x=-80,50, y=74,00, z=188,19], EntitySheep['Sheep'/62, l='MpServer', x=-87,42, y=73,00, z=207,23], EntitySheep['Sheep'/63, l='MpServer', x=-95,73, y=69,00, z=270,46], EntitySheep['Sheep'/64, l='MpServer', x=-81,21, y=72,00, z=281,77], EntitySheep['Sheep'/72, l='MpServer', x=-71,21, y=72,00, z=178,48], EntityBat['Bat'/73, l='MpServer', x=-69,47, y=31,10, z=199,65], EntityZombie['Zombie'/74, l='MpServer', x=-77,41, y=42,00, z=199,76], EntityCow['Cow'/75, l='MpServer', x=-75,97, y=71,00, z=195,84], EntitySheep['Sheep'/76, l='MpServer', x=-70,57, y=62,39, z=216,96], EntitySheep['Sheep'/77, l='MpServer', x=-69,73, y=72,00, z=267,17], EntitySheep['Sheep'/78, l='MpServer', x=-70,80, y=72,00, z=270,21], EntityCreeper['Creeper'/79, l='MpServer', x=-67,50, y=36,00, z=276,50], EntitySheep['Sheep'/80, l='MpServer', x=-74,70, y=72,00, z=280,81], EntitySheep['Sheep'/90, l='MpServer', x=-63,57, y=72,00, z=185,90], EntitySheep['Sheep'/91, l='MpServer', x=-65,18, y=71,00, z=195,23], EntityBat['Bat'/92, l='MpServer', x=-56,71, y=32,45, z=206,80], EntityCreeper['Creeper'/93, l='MpServer', x=-57,47, y=50,00, z=217,84], EntityCreeper['Creeper'/94, l='MpServer', x=-54,50, y=51,00, z=219,50], EntityZombie['Zombie'/95, l='MpServer', x=-58,41, y=50,00, z=220,17], EntitySpider['Spider'/96, l='MpServer', x=-50,00, y=36,00, z=236,70], EntityCreeper['Creeper'/97, l='MpServer', x=-52,50, y=50,00, z=235,50], EntityCreeper['Creeper'/98, l='MpServer', x=-53,50, y=50,00, z=235,50], EntityCreeper['Creeper'/99, l='MpServer', x=-49,99, y=52,00, z=224,58], EntityCreeper['Creeper'/100, l='MpServer', x=-50,63, y=52,00, z=225,21], EntityMinecartEmpty['entity.MinecartRideable.name'/101, l='MpServer', x=-48,37, y=72,00, z=233,67], EntityMountableBlock['entity.wm.MountableBlock.name'/102, l='MpServer', x=-51,50, y=72,44, z=224,50], EntityMountableBlock['entity.wm.MountableBlock.name'/103, l='MpServer', x=-51,50, y=72,44, z=225,50], EntityMountableBlock['entity.wm.MountableBlock.name'/104, l='MpServer', x=-51,50, y=72,44, z=226,50], EntityMountableBlock['entity.wm.MountableBlock.name'/105, l='MpServer', x=-51,50, y=72,44, z=227,50], EntityZombie['Zombie'/106, l='MpServer', x=-49,50, y=30,00, z=258,50], EntityCreeper['Creeper'/107, l='MpServer', x=-51,40, y=32,00, z=269,20], EntityCreeper['Creeper'/108, l='MpServer', x=-50,50, y=32,00, z=263,50], EntitySkeleton['Skeleton'/109, l='MpServer', x=-49,50, y=45,00, z=299,50], EntitySkeleton['Skeleton'/110, l='MpServer', x=-59,50, y=45,00, z=298,50], EntitySkeleton['Skeleton'/111, l='MpServer', x=-58,50, y=45,00, z=295,50], EntityCreeper['Creeper'/112, l='MpServer', x=-58,21, y=44,00, z=301,37], EntityZombie['Zombie'/114, l='MpServer', x=-56,50, y=34,00, z=307,50], EntityZombie['entity.Zombie.name'/120, l='MpServer', x=-43,50, y=23,00, z=158,50], EntityCreeper['Creeper'/121, l='MpServer', x=-40,50, y=23,00, z=157,50], EntitySheep['Sheep'/122, l='MpServer', x=-36,73, y=62,61, z=156,28], EntityWitch['Witch'/123, l='MpServer', x=-36,50, y=50,00, z=154,50], EntityZombie['Zombie'/124, l='MpServer', x=-40,50, y=44,00, z=176,50], EntityWitch['Witch'/125, l='MpServer', x=-41,43, y=38,00, z=222,95], EntitySkeleton['Skeleton'/126, l='MpServer', x=-38,69, y=21,00, z=239,49], EntityBat['Bat'/127, l='MpServer', x=-37,75, y=42,10, z=227,75], EntitySpider['Spider'/128, l='MpServer', x=-40,70, y=40,00, z=227,30], EntityWitch['Witch'/129, l='MpServer', x=-42,50, y=38,00, z=233,84], EntityZombie['Zombie'/130, l='MpServer', x=-35,49, y=54,46, z=229,38], EntityBat['Bat'/131, l='MpServer', x=-35,39, y=58,10, z=234,75], EntityCreeper['Creeper'/132, l='MpServer', x=-36,85, y=51,00, z=227,47], EntityZombie['Zombie'/133, l='MpServer', x=-45,52, y=47,00, z=228,60], EntityZombie['Zombie'/134, l='MpServer', x=-43,76, y=47,00, z=226,71], EntityCreeper['Creeper'/135, l='MpServer', x=-39,50, y=21,00, z=242,50], EntityCreeper['Creeper'/136, l='MpServer', x=-32,48, y=18,00, z=253,82], EntityZombie['Zombie'/137, l='MpServer', x=-47,50, y=32,00, z=267,50], EntitySkeleton['Skeleton'/138, l='MpServer', x=-40,50, y=48,00, z=290,50], EntitySkeleton['Skeleton'/139, l='MpServer', x=-45,53, y=48,00, z=293,23], EntityZombie['Zombie'/140, l='MpServer', x=-34,51, y=43,00, z=308,80], EntityBat['Bat'/147, l='MpServer', x=-17,47, y=46,10, z=172,54], EntitySheep['Sheep'/148, l='MpServer', x=-16,70, y=64,00, z=172,49], EntitySpider['Spider'/149, l='MpServer', x=-19,50, y=37,00, z=202,50], EntityBat['Bat'/150, l='MpServer', x=-22,22, y=42,73, z=199,75], EntityBat['Bat'/151, l='MpServer', x=-31,13, y=37,78, z=223,29], EntityBat['Bat'/152, l='MpServer', x=-25,63, y=40,28, z=210,24], EntityBat['Bat'/153, l='MpServer', x=-30,71, y=20,07, z=261,72], EntitySheep['Sheep'/154, l='MpServer', x=-28,73, y=70,00, z=299,53], EntitySheep['Sheep'/155, l='MpServer', x=-31,24, y=71,00, z=293,60], EntityCreeper['Creeper'/157, l='MpServer', x=-21,50, y=28,00, z=311,50], EntityZombie['Zombie'/163, l='MpServer', x=-6,50, y=27,00, z=152,50], EntityCreeper['Creeper'/164, l='MpServer', x=-6,50, y=16,00, z=167,50], EntityZombie['Zombie'/165, l='MpServer', x=-13,55, y=44,00, z=171,76], EntitySheep['Sheep'/167, l='MpServer', x=-10,67, y=63,00, z=190,23], EntitySpider['Spider'/168, l='MpServer', x=-7,58, y=23,00, z=201,11], EntityVillager['Villager'/169, l='MpServer', x=-13,50, y=71,00, z=207,89], EntityCreeper['Creeper'/170, l='MpServer', x=-1,16, y=42,00, z=219,50], EntityVillager['Villager'/171, l='MpServer', x=-10,50, y=71,00, z=213,50], EntitySheep['Sheep'/172, l='MpServer', x=-0,30, y=72,00, z=229,81], EntitySheep['Sheep'/173, l='MpServer', x=-8,19, y=72,00, z=255,51], EntitySkeleton['Skeleton'/174, l='MpServer', x=-3,50, y=57,00, z=271,50], EntitySheep['Sheep'/175, l='MpServer', x=-2,54, y=70,00, z=264,25], EntitySheep['Sheep'/176, l='MpServer', x=-0,19, y=70,00, z=281,49], EntitySheep['Sheep'/177, l='MpServer', x=-8,73, y=54,00, z=301,48], EntitySheep['Sheep'/178, l='MpServer', x=-8,50, y=67,00, z=293,80], EntityCreeper['Creeper'/180, l='MpServer', x=4,50, y=27,00, z=155,50], EntityCreeper['Creeper'/181, l='MpServer', x=5,22, y=24,00, z=162,59], EntitySkeleton['Skeleton'/182, l='MpServer', x=5,50, y=43,00, z=205,71], EntityBat['Bat'/183, l='MpServer', x=11,46, y=14,68, z=207,40], EntitySheep['Sheep'/184, l='MpServer', x=10,55, y=71,00, z=223,55], EntitySheep['Sheep'/185, l='MpServer', x=8,46, y=72,00, z=223,27], EntitySheep['Sheep'/186, l='MpServer', x=12,52, y=71,00, z=220,18], EntitySheep['Sheep'/187, l='MpServer', x=2,75, y=72,00, z=227,58], EntitySheep['Sheep'/188, l='MpServer', x=7,50, y=72,00, z=229,23], EntitySheep['Sheep'/189, l='MpServer', x=9,67, y=66,00, z=253,23], EntityCow['Cow'/190, l='MpServer', x=-4,49, y=71,28, z=248,34], EntitySheep['Sheep'/191, l='MpServer', x=15,51, y=66,00, z=260,73], EntityEnderman['Enderman'/192, l='MpServer', x=5,50, y=17,00, z=281,50], EntityChicken['Chicken'/193, l='MpServer', x=10,64, y=60,00, z=299,87], EntityBat['Bat'/195, l='MpServer', x=2,44, y=53,10, z=310,17], EntityCreeper['Creeper'/197, l='MpServer', x=24,47, y=53,00, z=211,15], EntitySheep['Sheep'/198, l='MpServer', x=25,55, y=64,00, z=218,38], EntityCreeper['Creeper'/199, l='MpServer', x=18,50, y=14,00, z=247,50], EntityCreeper['Creeper'/200, l='MpServer', x=17,50, y=14,00, z=249,50], EntitySheep['Sheep'/201, l='MpServer', x=25,73, y=64,00, z=274,51], EntitySheep['Sheep'/209, l='MpServer', x=36,91, y=63,00, z=262,51], EntitySheep['Sheep'/210, l='MpServer', x=36,27, y=68,00, z=264,51]] Retry entities: 0 total; [] Server brand: fml,forge Server type: Integrated singleplayer server Stacktrace: at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:451) at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2779) at net.minecraft.client.Minecraft.run(Minecraft.java:435) 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) -- System Details -- Details: Minecraft Version: 1.10.2 Operating System: Windows 10 (amd64) version 10.0 Java Version: 1.8.0_77, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 109343960 bytes (104 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB) JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M IntCache: cache: 0, tcache: 0, allocated: 13, tallocated: 95 FML: MCP 9.32 Powered by Forge 12.18.2.2099 4 mods loaded, 4 mods active States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored UCHIJAAAA mcp{9.19} [Minecraft Coder Pack] (minecraft.jar) UCHIJAAAA FML{8.0.99.99} [Forge Mod Loader] (forgeSrc-1.10.2-12.18.2.2099.jar) UCHIJAAAA Forge{12.18.2.2099} [Minecraft Forge] (forgeSrc-1.10.2-12.18.2.2099.jar) UCHIJAAAA wm{1.10.2_1.0.9b} [Walls mod] (bin) Loaded coremods (and transformers): GL info: ' Vendor: 'NVIDIA Corporation' Version: '4.5.0 NVIDIA 378.49' Renderer: 'GeForce GTX 1070/PCIe/SSE2' Launched Version: 1.10.2 LWJGL: 2.9.4 OpenGL: GeForce GTX 1070/PCIe/SSE2 GL version 4.5.0 NVIDIA 378.49, NVIDIA Corporation GL Caps: Using GL 1.3 multitexturing. Using GL 1.3 texture combiners. Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported. Shaders are available because OpenGL 2.1 is supported. VBOs are available because OpenGL 1.5 is supported. Using VBOs: Yes Is Modded: Definitely; Client brand changed to 'fml,forge' Type: Client (map_client.txt) Resource Packs: PureBDcraft 64x MC111.zip (incompatible) Current Language: English (US) Profiler Position: N/A (disabled) CPU: 4x Intel(R) Core(TM) i5-3570K CPU @ 3.40GHz
  17. I wasn't checking the whole block, but only the side that's facing my lantern, however when I tried to do it for more than one side the state wouldn't update, and when I went to F3 to see if the lantern had changed its properties I would get a crash, pointing back to where I was checking the sides for being solid. Maybe there's an easy way to add the check into the canConnectTo method? I was previously doing the check in my getActualState.
  18. Hey guys, I working on some lanterns that I want to connect to basically all solid side blocks (I hope you guys understand what I'm trying to say here), including stairs (much like torches do). I have looked at how torches connect to solid side blocks, but that would not be possible to do with my block, unless I rewrite most of the code, that I already have in my lantern class. public class LanternBlock extends Block { public static final PropertyBool UP = PropertyBool.create("up"); public static final PropertyBool NORTH = PropertyBool.create("north"); public static final PropertyBool EAST = PropertyBool.create("east"); public static final PropertyBool SOUTH = PropertyBool.create("south"); public static final PropertyBool WEST = PropertyBool.create("west"); protected static final double pixel = 1/16D; private static final AxisAlignedBB LANTERN_BOUNDING_AABB = new AxisAlignedBB(5*pixel, 0.0D, 5*pixel, 11*pixel, 13*pixel, 11*pixel); public LanternBlock(String name) { super(Material.ANVIL); this.setUnlocalizedName(name); this.setRegistryName(name); this.setHardness(1.0F); this.setSoundType(SoundType.ANVIL); this.isToolEffective("pickaxe", getDefaultState()); this.setCreativeTab(CreativeTabs.DECORATIONS); this.setDefaultState(this.blockState.getBaseState().withProperty(UP, Boolean.valueOf(false)).withProperty(NORTH, Boolean.valueOf(false)).withProperty(EAST, Boolean.valueOf(false)).withProperty(SOUTH, Boolean.valueOf(false)).withProperty(WEST, Boolean.valueOf(false))); } @Override public int getLightValue(IBlockState state) { return 15; } @Override public boolean isOpaqueCube(IBlockState state) { return false; } @Override public boolean isFullCube(IBlockState state) { return false; } @Override public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) { return LANTERN_BOUNDING_AABB; } @Override public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, World worldIn, BlockPos pos) { return LANTERN_BOUNDING_AABB; } @Override @SideOnly(Side.CLIENT) public BlockRenderLayer getBlockLayer() { return BlockRenderLayer.CUTOUT; } @SideOnly(Side.CLIENT) public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand) { double d0 = (double)pos.getX() + 0.5D; double d1 = (double)pos.getY() + 6.5*pixel; double d2 = (double)pos.getZ() + 0.5D; worldIn.spawnParticle(EnumParticleTypes.FLAME, d0, d1, d2, 0.0D, 0.0D, 0.0D, new int[0]); } @Override public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) { state = state.withProperty(UP, false).withProperty(NORTH, Boolean.valueOf(this.canConnectTo(worldIn, pos.north()))).withProperty(EAST, Boolean.valueOf(this.canConnectTo(worldIn, pos.east()))).withProperty(SOUTH, Boolean.valueOf(this.canConnectTo(worldIn, pos.south()))).withProperty(WEST, Boolean.valueOf(this.canConnectTo(worldIn, pos.west()))); IBlockState block_above = worldIn.getBlockState(pos.up()); if(!(block_above.getBlock() == null)) { if(block_above.isFullCube() || block_above.getProperties().containsValue(BlockSlab.EnumBlockHalf.BOTTOM) || block_above.getProperties().containsValue(BlockStairs.EnumHalf.BOTTOM)) { state = state.withProperty(UP, true); } } if(((Boolean)state.getValue(NORTH)).booleanValue() || ((Boolean)state.getValue(SOUTH)).booleanValue()) { state = state.withProperty(EAST, false).withProperty(WEST, false); } if(((Boolean)state.getValue(UP)).booleanValue()) { state = state.withProperty(NORTH, false).withProperty(EAST, false).withProperty(SOUTH, false).withProperty(WEST, false); } return state; } public boolean canConnectTo(IBlockAccess worldIn, BlockPos pos) { IBlockState state = worldIn.getBlockState(pos); return state.isFullCube(); } @Override public int getMetaFromState(IBlockState state) { return 0; } @Override protected BlockStateContainer createBlockState() { return new BlockStateContainer(this, new IProperty[] {UP, NORTH, EAST, WEST, SOUTH}); } } (Sorry for not putting code in a spoiler, couldn't find it with the new layout) I have tried something similar to how I did the block_above in the getActualState method, which worked fine if I was just checking one side, but if I added more it didn't work. But what I would like to know is if there's a way to check for stairs' solid side in my canConnectTo method perhaps, so that I didn't have to do some funky business? Also I know that my code most likely could be done much cleaner, but you know, if it ain't broke don't fix it
  19. Hey guys, I trying to make some chairs for my mod, and at the moment most of my code seems to be working fine. I can mount the chairs but not dismount them. I have been looking at how other mods are making their chairs just for reference, no copy paste, and there seems to not be any difference, other than some variable naming. Code can be found in the spoiler
  20. else-if is the correct solution, yes. You need to keep the IBlockState , not the Block (i.e. don't immediately call getBlock ). Then you can access all IBlockState methods, like getValue . I see, thank you
  21. Ok, let's walk through this assuming there is a slab below. [*] block_under is a BlockSlab so execute the if statement: set state to state.withProperty(SLAB_STAIR, true) . [*] block_under is not a BlockStair , so execute the else branch: set state to state.withProperty(SLAB_STAIR, false) . End result: SLAB_STAIR is set to false . I see now... I should use else if on the second if statement, or put both in the same one, right? BlockSlab and BlockStairs has a property HALF , which you can check. I think I understand this, but how would I get the property from block_under? I mean is there a "simple" way of getting it? I know I'm asking a lot here, and I want to thank you for your patience and help
  22. Regarding my little side question, I was wondering if anyone here knows if this is possible, and maybe how to do it?
×
×
  • Create New...

Important Information

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