Jump to content

LogicTechCorp

Forge Modder
  • Posts

    260
  • Joined

  • Last visited

Everything posted by LogicTechCorp

  1. Which custompayload packet do I use? S3FPacketCustomPayload or S3FPacketCustomPayload. Also what do I change this line too? Packet.writeItemStack(this.switchBlocks[var3], var2); Sorry for being a nuisance, I am not very good with handling packets.
  2. I am remaking an old mod and I cannot figure out how to update this piece of code: public Packet getAuxillaryInfoPacket() { ByteArrayOutputStream var1 = new ByteArrayOutputStream(); DataOutputStream var2 = new DataOutputStream(var1); try { var2.writeByte(0); var2.writeInt(this.xCoord); var2.writeShort(this.yCoord); var2.writeInt(this.zCoord); for (int var3 = 0; var3 < 2; ++var3) { Packet.writeItemStack(this.switchBlocks[var3], var2); } var2.writeByte((byte)(this.switchBlockDirection | (this.editState ? 16 : 0))); var2.writeByte((byte)(this.lightLevel | (this.isLightMinimum ? 16 : 0) | (this.switchSound ? 32 : 0))); byte[] var5 = var1.toByteArray(); var2.close(); return new Packet250CustomPayload("SecretSwitches", var5); } catch (IOException var4) { var4.printStackTrace(); return null; } }
  3. I registered it with the right bus but I keep on getting this crash: Crash ---- Minecraft Crash Report ---- // You should try our sister game, Minceraft! Time: 7/26/14 4:13 PM Description: Exception in server tick loop java.lang.ArrayIndexOutOfBoundsException: 4096 at net.minecraft.world.chunk.storage.ExtendedBlockStorage.getBlockByExtId(ExtendedBlockStorage.java:61) at com.logictechcorp.orizon.world.worldgen.StoneLayerGen.populateChunk(StoneLayerGen.java:58) at cpw.mods.fml.common.eventhandler.ASMEventHandler_5_StoneLayerGen_populateChunk_Pre.invoke(.dynamic) at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:51) at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:122) at net.minecraft.world.gen.ChunkProviderGenerate.populate(ChunkProviderGenerate.java:400) at net.minecraft.world.gen.ChunkProviderServer.populate(ChunkProviderServer.java:315) at net.minecraft.world.chunk.Chunk.populateChunk(Chunk.java:1163) at net.minecraft.world.gen.ChunkProviderServer.originalLoadChunk(ChunkProviderServer.java:210) at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:151) at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:121) at net.minecraft.server.MinecraftServer.initialWorldChunkLoad(MinecraftServer.java:315) at net.minecraft.server.integrated.IntegratedServer.loadAllWorlds(IntegratedServer.java:79) at net.minecraft.server.integrated.IntegratedServer.startServer(IntegratedServer.java:96) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:455) at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:762) A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- System Details -- Details: Minecraft Version: 1.7.10 Operating System: Windows 8.1 (amd64) version 6.3 Java Version: 1.7.0_55, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 902761424 bytes (860 MB) / 1056309248 bytes (1007 MB) up to 1056309248 bytes (1007 MB) JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used IntCache: cache: 0, tcache: 0, allocated: 13, tallocated: 95 FML: MCP v9.05 FML v7.10.1.1152 Minecraft Forge 10.13.0.1152 4 mods loaded, 4 mods active mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available FML{7.10.1.1152} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.0.1152.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available Forge{10.13.0.1152} [Minecraft Forge] (forgeSrc-1.7.10-10.13.0.1152.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available orizon{1.7.X-1.4} [Orizon] (Orizon) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available Profiler Position: N/A (disabled) Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used Player Count: 0 / 8; [] Type: Integrated Server (map_client.txt) Is Modded: Definitely; Client brand changed to 'fml,forge' Main Class @Mod(modid = Reference.MOD_ID, name = Reference.MOD_NAME, version = Reference.MOD_VERSION) public class Orizon { @Mod.Instance(Reference.MOD_ID) public static Orizon instance; @SidedProxy(clientSide = Reference.CLIENT_SIDE_CLASS, serverSide = Reference.SERVER_SIDE_CLASS) public static IProxy proxy; @Mod.EventHandler public void preInit(FMLPreInitializationEvent event) { ModBlocks.init(); ModOverrides.init(); } @Mod.EventHandler public void init(FMLInitializationEvent event) { MinecraftForge.EVENT_BUS.register(new StoneLayerGen()); ModRecipes.init(); ModWorldGen.init(); } @Mod.EventHandler public void postInit(FMLPostInitializationEvent event) { ModOreDictionary.init(); } } Event Class public class StoneLayerGen { @SubscribeEvent public void populateChunk(PopulateChunkEvent.Pre event) { Chunk chunk = event.world.getChunkFromChunkCoords(event.chunkX, event.chunkZ); for(ExtendedBlockStorage storage : chunk.getBlockStorageArray()) { if(storage != null) { for(int x = 0; x < 16; x++) { for(int z = 0; z < 16; z++) { for(int y = 0; y < 16; y++) { if(storage.getBlockByExtId(x, y, z) == Blocks.coal_ore) { storage.setExtBlockMetadata(x, y, z, ModBlocks.stratifiedCoalOre.damageDropped(0)); } if(storage.getBlockByExtId(x, y, z) == Blocks.emerald_ore) { storage.setExtBlockMetadata(x, y, z, ModBlocks.stratifiedEmeraldOre.damageDropped(0)); } if(storage.getBlockByExtId(x, y, z) == Blocks.gold_ore) { storage.setExtBlockMetadata(x, y, z, ModBlocks.stratifiedGoldOre.damageDropped(0)); } if(storage.getBlockByExtId(x, y, z) == Blocks.iron_ore) { storage.setExtBlockMetadata(x, y, z, ModBlocks.stratifiedIronOre.damageDropped(0)); } if(storage.getBlockByExtId(x, y, z) == Blocks.lapis_ore) { storage.setExtBlockMetadata(x, y, z, ModBlocks.stratifiedLapisOre.damageDropped(0)); } if(storage.getBlockByExtId(x, y, z) == Blocks.stone) { storage.setExtBlockMetadata(x, y, z, ModBlocks.coloredStone.damageDropped(4)); } } for(int y = 16; y < 32; y++) { if(storage.getBlockByExtId(x, y, z) == Blocks.coal_ore) { storage.setExtBlockMetadata(x, y, z, ModBlocks.stratifiedCoalOre.damageDropped(2)); } if(storage.getBlockByExtId(x, y, z) == Blocks.emerald_ore) { storage.setExtBlockMetadata(x, y, z, ModBlocks.stratifiedEmeraldOre.damageDropped(1)); } if(storage.getBlockByExtId(x, y, z) == Blocks.gold_ore) { storage.setExtBlockMetadata(x, y, z, ModBlocks.stratifiedGoldOre.damageDropped(1)); } if(storage.getBlockByExtId(x, y, z) == Blocks.iron_ore) { storage.setExtBlockMetadata(x, y, z, ModBlocks.stratifiedIronOre.damageDropped(2)); } if(storage.getBlockByExtId(x, y, z) == Blocks.lapis_ore) { storage.setExtBlockMetadata(x, y, z, ModBlocks.stratifiedLapisOre.damageDropped(1)); } if(storage.getBlockByExtId(x, y, z) == Blocks.stone) { storage.setExtBlockMetadata(x, y, z, ModBlocks.coloredStone.damageDropped(1)); } } for(int y = 32; y < 48; y++) { if(storage.getBlockByExtId(x, y, z) == Blocks.coal_ore) { storage.setExtBlockMetadata(x, y, z, ModBlocks.stratifiedCoalOre.damageDropped(3)); } if(storage.getBlockByExtId(x, y, z) == Blocks.emerald_ore) { storage.setExtBlockMetadata(x, y, z, ModBlocks.stratifiedEmeraldOre.damageDropped(2)); } if(storage.getBlockByExtId(x, y, z) == Blocks.gold_ore) { storage.setExtBlockMetadata(x, y, z, ModBlocks.stratifiedGoldOre.damageDropped(2)); } if(storage.getBlockByExtId(x, y, z) == Blocks.iron_ore) { storage.setExtBlockMetadata(x, y, z, ModBlocks.stratifiedIronOre.damageDropped(3)); } if(storage.getBlockByExtId(x, y, z) == Blocks.lapis_ore) { storage.setExtBlockMetadata(x, y, z, ModBlocks.stratifiedLapisOre.damageDropped(2)); } if(storage.getBlockByExtId(x, y, z) == Blocks.stone) { storage.setExtBlockMetadata(x, y, z, ModBlocks.coloredStone.damageDropped(14)); } } for(int y = 64; y < 256; y++) { if(storage.getBlockByExtId(x, y, z) == Blocks.coal_ore) { storage.setExtBlockMetadata(x, y, z, ModBlocks.stratifiedCoalOre.damageDropped(1)); } if(storage.getBlockByExtId(x, y, z) == Blocks.iron_ore) { storage.setExtBlockMetadata(x, y, z, ModBlocks.stratifiedIronOre.damageDropped(1)); } if(storage.getBlockByExtId(x, y, z) == Blocks.stone) { storage.setExtBlockMetadata(x, y, z, ModBlocks.coloredStone.damageDropped(6)); } } } } } } } }
  4. Make a custom WorldGenerator Class. It should look like this. public class SurfaceGen implements IWorldGenerator { @Override public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) { switch(world.provider.dimensionId) { case 0: generateSurface(world, random, chunkX * 16, chunkZ * 16); } } private void generateSurface(World world, Random random, int chunkX, int chunkZ) { for(int x = chunkX; x < chunkX + 16; x++) { for(int z = chunkZ; z < chunkZ + 16; z++) { for(int y = 0; y < 256; y++) { if(block == Blocks.stone) { world.setBlock(x, y, z, CUSTOM STONE BLOCK); } } Now you need to register your WorldGenerator Class in your main mod class @Mod.EventHandler public void init(FMLInitializationEvent event) { GameRegistry.registerWorldGenerator(new yourWorldGeneratorClassName(), 1); }
  5. I added in what you suggested but I keep on getting the same crash. Crash ---- Minecraft Crash Report ---- // There are four lights! Time: 7/23/14 11:52 AM Description: Unexpected error java.lang.ClassCastException: net.minecraft.client.entity.EntityClientPlayerMP cannot be cast to net.minecraft.entity.player.EntityPlayerMP at com.logictechcorp.orizon.block.BlockDreamBed.travelToDimension(BlockDreamBed.java:140) at com.logictechcorp.orizon.block.BlockDreamBed.setBedOccupied(BlockDreamBed.java:162) at net.minecraft.entity.player.EntityPlayer.wakeUpPlayer(EntityPlayer.java:1646) at net.minecraft.client.network.NetHandlerPlayClient.handleAnimation(NetHandlerPlayClient.java:829) at net.minecraft.network.play.server.S0BPacketAnimation.processPacket(S0BPacketAnimation.java:49) at net.minecraft.network.play.server.S0BPacketAnimation.processPacket(S0BPacketAnimation.java:77) at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:247) at net.minecraft.client.multiplayer.PlayerControllerMP.updateController(PlayerControllerMP.java:321) at net.minecraft.client.Minecraft.runTick(Minecraft.java:1692) at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1038) at net.minecraft.client.Minecraft.run(Minecraft.java:961) at net.minecraft.client.main.Main.main(Main.java:164) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at net.minecraft.launchwrapper.Launch.launch(Launch.java:134) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134) A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Stacktrace: at com.logictechcorp.orizon.block.BlockDreamBed.travelToDimension(BlockDreamBed.java:140) at com.logictechcorp.orizon.block.BlockDreamBed.setBedOccupied(BlockDreamBed.java:162) at net.minecraft.entity.player.EntityPlayer.wakeUpPlayer(EntityPlayer.java:1646) at net.minecraft.client.network.NetHandlerPlayClient.handleAnimation(NetHandlerPlayClient.java:829) at net.minecraft.network.play.server.S0BPacketAnimation.processPacket(S0BPacketAnimation.java:49) at net.minecraft.network.play.server.S0BPacketAnimation.processPacket(S0BPacketAnimation.java:77) at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:247) at net.minecraft.client.multiplayer.PlayerControllerMP.updateController(PlayerControllerMP.java:321) -- Affected level -- Details: Level name: MpServer All players: 1 total; [EntityClientPlayerMP['LogicTechCorp'/107, l='MpServer', x=164.50, y=73.76, z=277.90]] Chunk stats: MultiplayerChunkCache: 225, 225 Level seed: 0 Level generator: ID 00 - default, ver 1. Features enabled: false Level generator options: Level spawn location: World: (168,64,248), Chunk: (at 8,4,8 in 10,15; contains blocks 160,0,240 to 175,255,255), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511) Level time: 621 game time, 13056 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: 59 total; [EntityCow['Cow'/38, l='MpServer', x=89.03, y=72.00, z=322.06], EntityCow['Cow'/39, l='MpServer', x=88.28, y=70.00, z=331.78], EntityCow['Cow'/36, l='MpServer', x=85.25, y=70.00, z=262.22], EntityCow['Cow'/40, l='MpServer', x=85.44, y=71.00, z=324.41], EntityCow['Cow'/41, l='MpServer', x=85.50, y=71.00, z=322.50], EntityCow['Cow'/51, l='MpServer', x=97.91, y=69.00, z=200.50], EntityCow['Cow'/50, l='MpServer', x=96.47, y=69.00, z=200.50], EntityCow['Cow'/55, l='MpServer', x=129.50, y=73.00, z=237.50], EntityCow['Cow'/54, l='MpServer', x=121.94, y=75.00, z=245.81], EntityCow['Cow'/53, l='MpServer', x=101.50, y=69.00, z=200.50], EntityCow['Cow'/52, l='MpServer', x=99.22, y=69.00, z=200.50], EntityCow['Cow'/57, l='MpServer', x=132.50, y=74.00, z=235.50], EntityCow['Cow'/56, l='MpServer', x=130.50, y=72.00, z=233.50], EntityChicken['Chicken'/68, l='MpServer', x=146.47, y=71.00, z=223.31], EntityChicken['Chicken'/69, l='MpServer', x=148.53, y=72.00, z=226.47], EntityVillager['Villager'/70, l='MpServer', x=148.47, y=72.00, z=283.88], EntityCow['Cow'/71, l='MpServer', x=158.53, y=72.00, z=222.63], EntityChicken['Chicken'/66, l='MpServer', x=151.50, y=72.00, z=231.50], EntityChicken['Chicken'/67, l='MpServer', x=136.59, y=71.00, z=219.25], EntityVillager['Villager'/76, l='MpServer', x=155.66, y=70.00, z=282.44], EntityVillager['Villager'/77, l='MpServer', x=160.30, y=71.00, z=293.56], EntityVillager['Villager'/78, l='MpServer', x=170.34, y=71.00, z=265.41], EntityVillager['Villager'/79, l='MpServer', x=169.27, y=70.04, z=291.70], EntityCow['Cow'/72, l='MpServer', x=162.88, y=71.00, z=222.97], EntityCow['Cow'/73, l='MpServer', x=157.03, y=71.00, z=221.97], EntityCow['Cow'/74, l='MpServer', x=165.66, y=66.00, z=215.69], EntityVillager['Villager'/75, l='MpServer', x=167.50, y=69.00, z=277.25], EntityVillager['Villager'/85, l='MpServer', x=175.53, y=71.00, z=299.50], EntityVillager['Villager'/84, l='MpServer', x=169.47, y=71.00, z=295.88], EntityCow['Cow'/87, l='MpServer', x=174.50, y=70.00, z=320.50], EntityVillager['Villager'/86, l='MpServer', x=179.50, y=70.00, z=302.50], EntityCow['Cow'/81, l='MpServer', x=171.91, y=69.00, z=289.13], EntityCow['Cow'/80, l='MpServer', x=176.59, y=68.00, z=279.22], EntityCow['Cow'/83, l='MpServer', x=172.78, y=69.00, z=290.78], EntityCow['Cow'/82, l='MpServer', x=169.61, y=70.16, z=291.00], EntityCow['Cow'/95, l='MpServer', x=184.38, y=69.00, z=332.41], EntityCow['Cow'/89, l='MpServer', x=175.41, y=70.00, z=324.41], EntityCow['Cow'/88, l='MpServer', x=173.50, y=70.00, z=324.50], EntityCow['Cow'/90, l='MpServer', x=172.50, y=70.00, z=327.50], EntityPig['Pig'/102, l='MpServer', x=204.09, y=66.00, z=340.06], EntityPig['Pig'/100, l='MpServer', x=195.97, y=67.00, z=335.13], EntityPig['Pig'/101, l='MpServer', x=203.72, y=69.00, z=334.47], EntityCow['Cow'/98, l='MpServer', x=184.47, y=67.00, z=324.22], EntityPig['Pig'/99, l='MpServer', x=201.50, y=70.00, z=330.22], EntityCow['Cow'/96, l='MpServer', x=175.38, y=70.00, z=325.53], EntityCow['Cow'/97, l='MpServer', x=186.50, y=67.00, z=321.50], EntityChicken['Chicken'/106, l='MpServer', x=244.50, y=66.00, z=343.50], EntityItem['item.tile.flower1.dandelion'/2073, l='MpServer', x=144.91, y=75.13, z=311.66], EntityItem['item.item.seeds'/2116, l='MpServer', x=168.19, y=68.13, z=276.09], EntityBat['Bat'/4136, l='MpServer', x=191.72, y=34.73, z=218.00], EntityBat['Bat'/4140, l='MpServer', x=206.41, y=56.85, z=331.75], EntityClientPlayerMP['LogicTechCorp'/107, l='MpServer', x=164.50, y=73.76, z=277.90], EntityItem['item.tile.flower1.dandelion'/4321, l='MpServer', x=144.69, y=74.13, z=314.53], EntityBat['Bat'/487, l='MpServer', x=159.28, y=22.15, z=301.23], EntityBat['Bat'/556, l='MpServer', x=179.04, y=18.57, z=286.44], EntityBat['Bat'/555, l='MpServer', x=207.34, y=12.02, z=247.98], EntityBat['Bat'/542, l='MpServer', x=176.78, y=51.82, z=282.49], EntityBat['Bat'/619, l='MpServer', x=201.63, y=58.14, z=356.53], EntityBat['Bat'/620, l='MpServer', x=207.16, y=57.95, z=352.00]] Retry entities: 0 total; [] Server brand: fml,forge Server type: Integrated singleplayer server Stacktrace: at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:417) at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2567) at net.minecraft.client.Minecraft.run(Minecraft.java:990) at net.minecraft.client.main.Main.main(Main.java:164) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at net.minecraft.launchwrapper.Launch.launch(Launch.java:134) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134) -- System Details -- Details: Minecraft Version: 1.7.10 Operating System: Windows 8.1 (amd64) version 6.3 Java Version: 1.7.0_55, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 888591552 bytes (847 MB) / 1056309248 bytes (1007 MB) up to 1056309248 bytes (1007 MB) JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used IntCache: cache: 0, tcache: 0, allocated: 13, tallocated: 95 FML: MCP v9.05 FML v7.10.1.1152 Minecraft Forge 10.13.0.1152 4 mods loaded, 4 mods active mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available FML{7.10.1.1152} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.0.1152.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available Forge{10.13.0.1152} [Minecraft Forge] (forgeSrc-1.7.10-10.13.0.1152.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available orizon{1.7.X-1.4} [Orizon] (Orizon) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available Launched Version: 1.7 LWJGL: 2.9.1 OpenGL: Intel(R) HD Graphics GL version 4.0.0 - Build 10.18.10.3621, Intel GL Caps: Using GL 1.3 multitexturing. Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported. Anisotropic filtering is supported and maximum anisotropy is 16. Shaders are available because OpenGL 2.1 is supported. Is Modded: Definitely; Client brand changed to 'fml,forge' Type: Client (map_client.txt) Resource Packs: [] Current Language: English (US) Profiler Position: N/A (disabled) Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used Anisotropic Filtering: Off (1) Code public void travelToDimension(World world, EntityPlayer player) { EntityPlayerMP playerMP = (EntityPlayerMP) player; WorldServer ws = (WorldServer) world; if(playerMP.dimension != Reference.DREAMSCAPE_DIMENSION_ID) { playerMP.mcServer.getConfigurationManager().transferPlayerToDimension(playerMP, Reference.DREAMSCAPE_DIMENSION_ID, new TeleporterDreamscape(ws)); } else { playerMP.mcServer.getConfigurationManager().transferPlayerToDimension(playerMP, 0, new TeleporterDreamscape(ws)); } } @Override public void setBedOccupied(IBlockAccess world, int x, int y, int z, EntityPlayer player, boolean occupied) { if(world instanceof World) { BlockDreamBed.func_149979_a((World) world, x, y, z, occupied); if(((World) world).isRemote) { if(!occupied) { travelToDimension((World) world, player); } } } }
  6. I have code that teleports the player between the dimension using the onBlockClicked Event but when I try to use my code in the SetBedOccupied Event I crash when the player is about to wake up. When I rejoin the world I am in my dimension. Crash Report https://gist.github.com/a0ddf8cbd5cf991ace03.git Code public void getDimension(World world, EntityPlayer player) { EntityPlayerMP thePlayer = (EntityPlayerMP) player; WorldServer ws = (WorldServer) world; if(thePlayer.dimension != Reference.DREAMSCAPE_DIMENSION_ID) { thePlayer.mcServer.getConfigurationManager().transferPlayerToDimension(thePlayer, Reference.DREAMSCAPE_DIMENSION_ID, new TeleporterDreamscape(ws)); } else { thePlayer.mcServer.getConfigurationManager().transferPlayerToDimension(thePlayer, 0, new TeleporterDreamscape(ws)); } } @Override public void setBedOccupied(IBlockAccess world, int x, int y, int z, EntityPlayer player, boolean occupied) { if(world instanceof World) { BlockDreamBed.func_149979_a((World) world, x, y, z, occupied); if(!occupied) { getDimension((World) world, player); } } }
  7. I am sorry for not being clear earlier. There is two different dimensions, the Overworld and the Dream World. The player is going to sleep in their bed in the Overworld and have a random chance of waking up in the Dream World. The player wakes up in the exact same location in the Dream World as they were in the Overworld and when the player is done in the Dream World they will sleep and wake up in the Overworld.
  8. Say location A is the players bed and location B is a bed at spawn. When the player sleeps in their bed (A) they have a random chance of teleporting to bed (B) at spawn, when they sleep in bed (B) they teleport to their bed (A)
  9. Hello there, I made a custom bed that works like a normal bed but I would like it to teleport the player to a new location and set a bed there, interlinking the two. Example: The player sleeps in bed A at location A and has a random chance of teleporting to location B. When the player is teleported to location B, bed B is created. Bed A will always have a random chance of teleporting the player to bed B but bed B will always teleport to bed A.
  10. I went and tinkered with the code and now I am being sent to the nether, any idea on what is wrong. Here are the links to any classes that may be relevant. Main https://github.com/LogicTechCorp/Orizon/blob/master/src/main/java/com/logictechcorp/orizon/Orizon.java BlueFire https://github.com/LogicTechCorp/Orizon/blob/master/src/main/java/com/logictechcorp/orizon/block/BlockBlueFire.java Portal Block https://github.com/LogicTechCorp/Orizon/blob/master/src/main/java/com/logictechcorp/orizon/block/BlockDreamscapePortal.java Block Registry https://github.com/LogicTechCorp/Orizon/blob/master/src/main/java/com/logictechcorp/orizon/init/ModBlocks.java Dimension Registry https://github.com/LogicTechCorp/Orizon/blob/master/src/main/java/com/logictechcorp/orizon/init/ModDimensionManager.java Item Registry https://github.com/LogicTechCorp/Orizon/blob/master/src/main/java/com/logictechcorp/orizon/init/ModItems.java Item Blue Flint and Steel https://github.com/LogicTechCorp/Orizon/blob/master/src/main/java/com/logictechcorp/orizon/item/ItemBlueFlintandSteel.java Chunk Provider https://github.com/LogicTechCorp/Orizon/blob/master/src/main/java/com/logictechcorp/orizon/world/chunk/ChunkProviderDreamscape.java Teleporter https://github.com/LogicTechCorp/Orizon/blob/master/src/main/java/com/logictechcorp/orizon/world/TeleporterDreamscape.java World Provider https://github.com/LogicTechCorp/Orizon/blob/master/src/main/java/com/logictechcorp/orizon/world/WorldProviderDreamscape.java
  11. Every time I teleport to my dimension the game crashes and when I load it back up I am in my dimension with a half made portal and when I teleport back the same thing happens. Here is a picture, the crash report and the two classes that are in the crash report. https://dl.dropboxusercontent.com/u/248986518/2014-07-20_13.39.51.png[/img] ---- Minecraft Crash Report ---- // Would you like a cupcake? Time: 7/20/14 1:40 PM Description: Colliding entity with block java.lang.NullPointerException: Colliding entity with block at net.minecraft.world.chunk.storage.ExtendedBlockStorage.func_150818_a(ExtendedBlockStorage.java:96) at net.minecraft.world.chunk.Chunk.func_150807_a(Chunk.java:667) at net.minecraft.world.World.setBlock(World.java:515) at com.logictechcorp.orizon.world.TeleporterDreamscape.makePortal(TeleporterDreamscape.java:455) at com.logictechcorp.orizon.world.TeleporterDreamscape.placeInPortal(TeleporterDreamscape.java:44) at net.minecraft.server.management.ServerConfigurationManager.transferEntityToWorld(ServerConfigurationManager.java:629) at net.minecraft.server.management.ServerConfigurationManager.transferPlayerToDimension(ServerConfigurationManager.java:533) at com.logictechcorp.orizon.block.BlockDreamscapePortal.onEntityCollidedWithBlock(BlockDreamscapePortal.java:232) at net.minecraft.entity.Entity.func_145775_I(Entity.java:988) at net.minecraft.entity.Entity.moveEntity(Entity.java:921) at net.minecraft.network.NetHandlerPlayServer.processPlayer(NetHandlerPlayServer.java:367) at net.minecraft.network.play.client.C03PacketPlayer.processPacket(C03PacketPlayer.java:37) at net.minecraft.network.play.client.C03PacketPlayer$C06PacketPlayerPosLook.processPacket(C03PacketPlayer.java:271) at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:247) at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182) at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:736) at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:624) at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:495) at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:762) A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Stacktrace: at net.minecraft.world.chunk.storage.ExtendedBlockStorage.func_150818_a(ExtendedBlockStorage.java:96) at net.minecraft.world.chunk.Chunk.func_150807_a(Chunk.java:667) at net.minecraft.world.World.setBlock(World.java:515) at com.logictechcorp.orizon.world.TeleporterDreamscape.makePortal(TeleporterDreamscape.java:455) at com.logictechcorp.orizon.world.TeleporterDreamscape.placeInPortal(TeleporterDreamscape.java:44) at net.minecraft.server.management.ServerConfigurationManager.transferEntityToWorld(ServerConfigurationManager.java:629) at net.minecraft.server.management.ServerConfigurationManager.transferPlayerToDimension(ServerConfigurationManager.java:533) at com.logictechcorp.orizon.block.BlockDreamscapePortal.onEntityCollidedWithBlock(BlockDreamscapePortal.java:232) -- Block being collided with -- Details: Block type: ID #180 (tile.null // com.logictechcorp.orizon.block.BlockDreamscapePortal) Block data value: 0 / 0x0 / 0b0000 Block location: World: (-304,76,155), Chunk: (at 0,4,11 in -19,9; contains blocks -304,0,144 to -289,255,159), Region: (-1,0; contains chunks -32,0 to -1,31, blocks -512,0,0 to -1,255,511) Stacktrace: at net.minecraft.entity.Entity.func_145775_I(Entity.java:988) -- Entity being checked for collision -- Details: Entity Type: null (net.minecraft.entity.player.EntityPlayerMP) Entity ID: 314 Entity Name: LogicTechCorp Entity's Exact location: -302.00, 76.00, 156.00 Entity's Block location: World: (-302,76,156), Chunk: (at 2,4,12 in -19,9; contains blocks -304,0,144 to -289,255,159), Region: (-1,0; contains chunks -32,0 to -1,31, blocks -512,0,0 to -1,255,511) Entity's Momentum: 0.00, -0.08, 0.00 Stacktrace: at net.minecraft.entity.Entity.moveEntity(Entity.java:921) at net.minecraft.network.NetHandlerPlayServer.processPlayer(NetHandlerPlayServer.java:367) at net.minecraft.network.play.client.C03PacketPlayer.processPacket(C03PacketPlayer.java:37) at net.minecraft.network.play.client.C03PacketPlayer$C06PacketPlayerPosLook.processPacket(C03PacketPlayer.java:271) at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:247) -- Ticking connection -- Details: Connection: net.minecraft.network.NetworkManager@3f43308 Stacktrace: at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182) at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:736) at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:624) at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:495) at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:762) -- System Details -- Details: Minecraft Version: 1.7.10 Operating System: Windows 8.1 (amd64) version 6.3 Java Version: 1.7.0_55, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 882987520 bytes (842 MB) / 1056309248 bytes (1007 MB) up to 1056309248 bytes (1007 MB) JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used IntCache: cache: 0, tcache: 0, allocated: 12, tallocated: 94 FML: MCP v9.05 FML v7.10.1.1152 Minecraft Forge 10.13.0.1152 4 mods loaded, 4 mods active mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available FML{7.10.1.1152} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.0.1152.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available Forge{10.13.0.1152} [Minecraft Forge] (forgeSrc-1.7.10-10.13.0.1152.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available orizon{1.7.X-1.4} [Orizon] (Orizon) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available Profiler Position: N/A (disabled) Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used Player Count: 1 / 8; [EntityPlayerMP['LogicTechCorp'/314, l='New World', x=-302.00, y=76.00, z=156.00]] Type: Integrated Server (map_client.txt) Is Modded: Definitely; Client brand changed to 'fml,forge' public static BlockDreamscapePortal portal; private final WorldServer worldServerInstance; private final Random random; private final LongHashMap destinationCoordinateCache = new LongHashMap(); private final List destinationCoordinateKeys = new ArrayList(); public TeleporterDreamscape(WorldServer worldServer) { super(worldServer); this.worldServerInstance = worldServer; this.random = new Random(worldServer.getSeed()); } public void placeInPortal(Entity entity, double x, double y, double z, float f) { if(this.worldServerInstance.provider.dimensionId != 1) { if(!this.placeInExistingPortal(entity, x, y, z, f)) { this.makePortal(entity); this.placeInExistingPortal(entity, x, y, z, f); } } else { int i = MathHelper.floor_double(entity.posX); int j = MathHelper.floor_double(entity.posY) - 1; int k = MathHelper.floor_double(entity.posZ); byte b0 = 1; byte b1 = 0; for(int l = -2; l <= 2; ++l) { for(int i1 = -2; i1 <= 2; ++i1) { for(int j1 = -1; j1 < 3; ++j1) { int k1 = i + i1 * b0 + l * b1; int l1 = j + j1; int i2 = k + i1 * b1 - l * b0; boolean flag = j1 < 0; this.worldServerInstance.setBlock(k1, l1, i2, flag ? ModBlocks.coloredStoneBrick : Blocks.air); } } } entity.setLocationAndAngles((double) i, (double) j, (double) k, entity.rotationYaw, 0.0F); entity.motionX = entity.motionY = entity.motionZ = 0.0D; } } public boolean placeInExistingPortal(Entity entity, double x, double y, double z, float f) { short short1 = 128; double d3 = -1.0D; int i = 0; int j = 0; int k = 0; int l = MathHelper.floor_double(entity.posX); int i1 = MathHelper.floor_double(entity.posZ); long j1 = ChunkCoordIntPair.chunkXZ2Int(l, i1); boolean flag = true; double d7; int l3; if(this.destinationCoordinateCache.containsItem(j1)) { Teleporter.PortalPosition portalposition = (Teleporter.PortalPosition) this.destinationCoordinateCache.getValueByKey(j1); d3 = 0.0D; i = portalposition.posX; j = portalposition.posY; k = portalposition.posZ; portalposition.lastUpdateTime = this.worldServerInstance.getTotalWorldTime(); flag = false; } else { for(l3 = l - short1; l3 <= l + short1; ++l3) { double d4 = (double) l3 + 0.5D - entity.posX; for(int l1 = i1 - short1; l1 <= i1 + short1; ++l1) { double d5 = (double) l1 + 0.5D - entity.posZ; for(int i2 = this.worldServerInstance.getActualHeight() - 1; i2 >= 0; --i2) { if(this.worldServerInstance.getBlock(l3, i2, l1) == portal) { while(this.worldServerInstance.getBlock(l3, i2 - 1, l1) == portal) { --i2; } d7 = (double) i2 + 0.5D - entity.posY; double d8 = d4 * d4 + d7 * d7 + d5 * d5; if(d3 < 0.0D || d8 < d3) { d3 = d8; i = l3; j = i2; k = l1; } } } } } } if(d3 >= 0.0D) { if(flag) { this.destinationCoordinateCache.add(j1, new Teleporter.PortalPosition(i, j, k, this.worldServerInstance.getTotalWorldTime())); this.destinationCoordinateKeys.add(Long.valueOf(j1)); } double d11 = (double) i + 0.5D; double d6 = (double) j + 0.5D; d7 = (double) k + 0.5D; int i4 = -1; if(this.worldServerInstance.getBlock(i - 1, j, k) == portal) { i4 = 2; } if(this.worldServerInstance.getBlock(i + 1, j, k) == portal) { i4 = 0; } if(this.worldServerInstance.getBlock(i, j, k - 1) == portal) { i4 = 3; } if(this.worldServerInstance.getBlock(i, j, k + 1) == portal) { i4 = 1; } int j2 = entity.getTeleportDirection(); if(i4 > -1) { int k2 = Direction.rotateLeft[i4]; int l2 = Direction.offsetX[i4]; int i3 = Direction.offsetZ[i4]; int j3 = Direction.offsetX[k2]; int k3 = Direction.offsetZ[k2]; boolean flag1 = !this.worldServerInstance.isAirBlock(i + l2 + j3, j, k + i3 + k3) || !this.worldServerInstance.isAirBlock(i + l2 + j3, j + 1, k + i3 + k3); boolean flag2 = !this.worldServerInstance.isAirBlock(i + l2, j, k + i3) || !this.worldServerInstance.isAirBlock(i + l2, j + 1, k + i3); if(flag1 && flag2) { i4 = Direction.rotateOpposite[i4]; k2 = Direction.rotateOpposite[k2]; l2 = Direction.offsetX[i4]; i3 = Direction.offsetZ[i4]; j3 = Direction.offsetX[k2]; k3 = Direction.offsetZ[k2]; l3 = i - j3; d11 -= (double) j3; int k1 = k - k3; d7 -= (double) k3; flag1 = !this.worldServerInstance.isAirBlock(l3 + l2 + j3, j, k1 + i3 + k3) || !this.worldServerInstance.isAirBlock(l3 + l2 + j3, j + 1, k1 + i3 + k3); flag2 = !this.worldServerInstance.isAirBlock(l3 + l2, j, k1 + i3) || !this.worldServerInstance.isAirBlock(l3 + l2, j + 1, k1 + i3); } float f1 = 0.5F; float f2 = 0.5F; if(!flag1 && flag2) { f1 = 1.0F; } else if(flag1 && !flag2) { f1 = 0.0F; } else if(flag1 && flag2) { f2 = 0.0F; } d11 += (double) ((float) j3 * f1 + f2 * (float) l2); d7 += (double) ((float) k3 * f1 + f2 * (float) i3); float f3 = 0.0F; float f4 = 0.0F; float f5 = 0.0F; float f6 = 0.0F; if(i4 == j2) { f3 = 1.0F; f4 = 1.0F; } else if(i4 == Direction.rotateOpposite[j2]) { f3 = -1.0F; f4 = -1.0F; } else if(i4 == Direction.rotateRight[j2]) { f5 = 1.0F; f6 = -1.0F; } else { f5 = -1.0F; f6 = 1.0F; } double d9 = entity.motionX; double d10 = entity.motionZ; entity.motionX = d9 * (double) f3 + d10 * (double) f6; entity.motionZ = d9 * (double) f5 + d10 * (double) f4; entity.rotationYaw = f - (float) (j2 * 90) + (float) (i4 * 90); } else { entity.motionX = entity.motionY = entity.motionZ = 0.0D; } entity.setLocationAndAngles(d11, d6, d7, entity.rotationYaw, entity.rotationPitch); return true; } else { return false; } } public boolean makePortal(Entity entity) { byte b0 = 16; double d0 = -1.0D; int i = MathHelper.floor_double(entity.posX); int j = MathHelper.floor_double(entity.posY); int k = MathHelper.floor_double(entity.posZ); int l = i; int i1 = j; int j1 = k; int k1 = 0; int l1 = this.random.nextInt(4); int i2; double d1; double d2; int k2; int i3; int k3; int j3; int i4; int l3; int k4; int j4; int i5; int l4; double d3; double d4; for(i2 = i - b0; i2 <= i + b0; ++i2) { d1 = (double) i2 + 0.5D - entity.posX; for(k2 = k - b0; k2 <= k + b0; ++k2) { d2 = (double) k2 + 0.5D - entity.posZ; label274: for(i3 = this.worldServerInstance.getActualHeight() - 1; i3 >= 0; --i3) { if(this.worldServerInstance.isAirBlock(i2, i3, k2)) { while(i3 > 0 && this.worldServerInstance.isAirBlock(i2, i3 - 1, k2)) { --i3; } for(j3 = l1; j3 < l1 + 4; ++j3) { k3 = j3 % 2; l3 = 1 - k3; if(j3 % 4 >= 2) { k3 = -k3; l3 = -l3; } for(i4 = 0; i4 < 3; ++i4) { for(j4 = 0; j4 < 4; ++j4) { for(k4 = -1; k4 < 4; ++k4) { l4 = i2 + (j4 - 1) * k3 + i4 * l3; i5 = i3 + k4; int j5 = k2 + (j4 - 1) * l3 - i4 * k3; if(k4 < 0 && !this.worldServerInstance.getBlock(l4, i5, j5).getMaterial().isSolid() || k4 >= 0 && !this.worldServerInstance.isAirBlock(l4, i5, j5)) { continue label274; } } } } d4 = (double) i3 + 0.5D - entity.posY; d3 = d1 * d1 + d4 * d4 + d2 * d2; if(d0 < 0.0D || d3 < d0) { d0 = d3; l = i2; i1 = i3; j1 = k2; k1 = j3 % 4; } } } } } } if(d0 < 0.0D) { for(i2 = i - b0; i2 <= i + b0; ++i2) { d1 = (double) i2 + 0.5D - entity.posX; for(k2 = k - b0; k2 <= k + b0; ++k2) { d2 = (double) k2 + 0.5D - entity.posZ; label222: for(i3 = this.worldServerInstance.getActualHeight() - 1; i3 >= 0; --i3) { if(this.worldServerInstance.isAirBlock(i2, i3, k2)) { while(i3 > 0 && this.worldServerInstance.isAirBlock(i2, i3 - 1, k2)) { --i3; } for(j3 = l1; j3 < l1 + 2; ++j3) { k3 = j3 % 2; l3 = 1 - k3; for(i4 = 0; i4 < 4; ++i4) { for(j4 = -1; j4 < 4; ++j4) { k4 = i2 + (i4 - 1) * k3; l4 = i3 + j4; i5 = k2 + (i4 - 1) * l3; if(j4 < 0 && !this.worldServerInstance.getBlock(k4, l4, i5).getMaterial().isSolid() || j4 >= 0 && !this.worldServerInstance.isAirBlock(k4, l4, i5)) { continue label222; } } } d4 = (double) i3 + 0.5D - entity.posY; d3 = d1 * d1 + d4 * d4 + d2 * d2; if(d0 < 0.0D || d3 < d0) { d0 = d3; l = i2; i1 = i3; j1 = k2; k1 = j3 % 2; } } } } } } } int k5 = l; int j2 = i1; k2 = j1; int l5 = k1 % 2; int l2 = 1 - l5; if(k1 % 4 >= 2) { l5 = -l5; l2 = -l2; } boolean flag; if(d0 < 0.0D) { if(i1 < 70) { i1 = 70; } if(i1 > this.worldServerInstance.getActualHeight() - 10) { i1 = this.worldServerInstance.getActualHeight() - 10; } j2 = i1; for(i3 = -1; i3 <= 1; ++i3) { for(j3 = 1; j3 < 3; ++j3) { for(k3 = -1; k3 < 3; ++k3) { l3 = k5 + (j3 - 1) * l5 + i3 * l2; i4 = j2 + k3; j4 = k2 + (j3 - 1) * l2 - i3 * l5; flag = k3 < 0; this.worldServerInstance.setBlock(l3, i4, j4, flag ? ModBlocks.coloredStoneBrick : Blocks.air); } } } } for(i3 = 0; i3 < 4; ++i3) { for(j3 = 0; j3 < 4; ++j3) { for(k3 = -1; k3 < 4; ++k3) { l3 = k5 + (j3 - 1) * l5; i4 = j2 + k3; j4 = k2 + (j3 - 1) * l2; flag = j3 == 0 || j3 == 3 || k3 == -1 || k3 == 3; this.worldServerInstance.setBlock(l3, i4, j4, (flag ? ModBlocks.coloredStoneBrick : portal), 0, 2); } } for(j3 = 0; j3 < 4; ++j3) { for(k3 = -1; k3 < 4; ++k3) { l3 = k5 + (j3 - 1) * l5; i4 = j2 + k3; j4 = k2 + (j3 - 1) * l2; this.worldServerInstance.notifyBlocksOfNeighborChange(l3, i4, j4, this.worldServerInstance.getBlock(l3, i4, j4)); } } } return true; } public void removeStalePortalLocations(long par1) { if(par1 % 100L == 0L) { Iterator iterator = this.destinationCoordinateKeys.iterator(); long j = par1 - 600L; while(iterator.hasNext()) { Long olong = (Long) iterator.next(); Teleporter.PortalPosition portalposition = (Teleporter.PortalPosition) this.destinationCoordinateCache.getValueByKey(olong.longValue()); if(portalposition == null || portalposition.lastUpdateTime < j) { iterator.remove(); this.destinationCoordinateCache.remove(olong.longValue()); } } } } public class BlockDreamscapePortal extends BlockBreakable { public BlockDreamscapePortal() { super("", Material.portal, false); this.setTickRandomly(true); this.setHardness(-1.0F); this.setLightLevel(0.75F); } public void updateTick(World world, int x, int y, int z, Random random) { super.updateTick(world, x, y, z, random); if (world.provider.isSurfaceWorld()) { int l; for (l = y; !world.doesBlockHaveSolidTopSurface(world, x, l, z) && l > 0; --l) { ; } if (l > 0 && !world.isBlockNormalCubeDefault(x, l + 1, z, true)) { Entity entity = ItemMonsterPlacer.spawnCreature(world, 57, (double)x + 0.5D, (double)l + 1.1D, (double)z + 0.5D); if (entity != null) { entity.timeUntilPortal = entity.getPortalCooldown(); } } } } public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) { return null; } public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int x, int y, int z) { float f; float f1; if (par1IBlockAccess.getBlock(x - 1, y, z) != this && par1IBlockAccess.getBlock(x + 1, y, z) != this) { f = 0.125F; f1 = 0.5F; this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f1, 0.5F + f, 1.0F, 0.5F + f1); } else { f = 0.5F; f1 = 0.125F; this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f1, 0.5F + f, 1.0F, 0.5F + f1); } } public boolean isOpaqueCube() { return false; } @Override public boolean renderAsNormalBlock() { return false; } public static boolean tryToCreatePortal(World world, int x, int y, int z) { byte b0 = 0; byte b1 = 0; if (world.getBlock(x - 1, y, z) == ModBlocks.coloredStoneBrick || world.getBlock(x + 1, y, z) == ModBlocks.coloredStoneBrick) { b0 = 1; } if (world.getBlock(x, y, z - 1) == ModBlocks.coloredStoneBrick || world.getBlock(x, y, z + 1) == ModBlocks.coloredStoneBrick) { b1 = 1; } if (b0 == b1) { return false; } else { if (world.getBlock(x - b0, y, z - b1) == Blocks.air) { x -= b0; z -= b1; } int l; int i1; for (l = -1; l <= 2; ++l) { for (i1 = -1; i1 <= 3; ++i1) { boolean flag = l == -1 || l == 2 || i1 == -1 || i1 == 3; if (l != -1 && l != 2 || i1 != -1 && i1 != 3) { Block j1 = world.getBlock(x + b0 * l, y + i1, z + b1 * l); if (flag) { if (j1 != ModBlocks.coloredStoneBrick) { return false; } } } } } for (l = 0; l < 2; ++l) { for (i1 = 0; i1 < 3; ++i1) { world.setBlock(x + b0 * l, y + i1, z + b1 * l, ModBlocks.dreamscapePortal, 0, 2); } } return true; } } public void onNeighborBlockChange(World world, int x, int y, int z, int par5) { byte b0 = 0; byte b1 = 1; if (world.getBlock(x - 1, y, z) == this || world.getBlock(x + 1, y, z) == this) { b0 = 1; b1 = 0; } int i1; for (i1 = y; world.getBlock(x, i1 - 1, z) == this; --i1) { ; } if (world.getBlock(x, i1 - 1, z) != ModBlocks.coloredStoneBrick) { world.setBlockToAir(x, y, z); } else { int j1; for (j1 = 1; j1 < 4 && world.getBlock(x, i1 + j1, z) == this; ++j1) { ; } if (j1 == 3 && world.getBlock(x, i1 + j1, z) == ModBlocks.coloredStoneBrick) { boolean flag = world.getBlock(x - 1, y, z) == this || world.getBlock(x + 1, y, z) == this; boolean flag1 = world.getBlock(x, y, z - 1) == this || world.getBlock(x, y, z + 1) == this; if (flag && flag1) { world.setBlockToAir(x, y, z); } else { if ((world.getBlock(x + b0, y, z + b1) != ModBlocks.coloredStoneBrick || world.getBlock(x - b0, y, z - b1) != this) && (world.getBlock(x - b0, y, z - b1) != ModBlocks.coloredStoneBrick || world.getBlock(x + b0, y, z + b1) != this)) { world.setBlockToAir(x, y, z); } } } else { world.setBlockToAir(x, y, z); } } } @SideOnly(Side.CLIENT) public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int x, int y, int z, int par5) { if (par1IBlockAccess.getBlock(x, y, z) == this) { return false; } else { boolean flag = par1IBlockAccess.getBlock(x - 1, y, z) == this && par1IBlockAccess.getBlock(x - 2, y, z) != this; boolean flag1 = par1IBlockAccess.getBlock(x + 1, y, z) == this && par1IBlockAccess.getBlock(x + 2, y, z) != this; boolean flag2 = par1IBlockAccess.getBlock(x, y, z - 1) == this && par1IBlockAccess.getBlock(x, y, z - 2) != this; boolean flag3 = par1IBlockAccess.getBlock(x, y, z + 1) == this && par1IBlockAccess.getBlock(x, y, z + 2) != this; boolean flag4 = flag || flag1; boolean flag5 = flag2 || flag3; return flag4 && par5 == 4 ? true : (flag4 && par5 == 5 ? true : (flag5 && par5 == 2 ? true : flag5 && par5 == 3)); } } public int quantityDropped(Random par1Random) { return 0; } public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity par5Entity) { if ((par5Entity.ridingEntity == null) && (par5Entity.riddenByEntity == null) && ((par5Entity instanceof EntityPlayerMP))) { EntityPlayerMP thePlayer = (EntityPlayerMP)par5Entity; if (thePlayer.timeUntilPortal > 0) { thePlayer.timeUntilPortal = 10; } else if (thePlayer.dimension != Reference.DREAMSCAPE_DIMENSION_ID) { thePlayer.timeUntilPortal = 10; thePlayer.mcServer.getConfigurationManager().transferPlayerToDimension(thePlayer, Reference.DREAMSCAPE_DIMENSION_ID, new TeleporterDreamscape(thePlayer.mcServer.worldServerForDimension(Reference.DREAMSCAPE_DIMENSION_ID))); } else { thePlayer.timeUntilPortal = 10; thePlayer.mcServer.getConfigurationManager().transferPlayerToDimension(thePlayer, 0, new TeleporterDreamscape(thePlayer.mcServer.worldServerForDimension(0))); } } } @SideOnly(Side.CLIENT) public int getRenderBlockPass() { return 1; } @SideOnly(Side.CLIENT) public void randomDisplayTick(World world, int x, int y, int z, Random random) { if (random.nextInt(100) == 0) { world.playSound((double)x + 0.5D, (double)y + 0.5D, (double)z + 0.5D, "portal.portal", 0.5F, random.nextFloat() * 0.4F + 0.8F, false); } for (int l = 0; l < 4; ++l) { double d0 = (double)((float)x + random.nextFloat()); double d1 = (double)((float)y + random.nextFloat()); double d2 = (double)((float)z + random.nextFloat()); double d3 = 0.0D; double d4 = 0.0D; double d5 = 0.0D; int i1 = random.nextInt(2) * 2 - 1; d3 = ((double)random.nextFloat() - 0.5D) * 0.5D; d4 = ((double)random.nextFloat() - 0.5D) * 0.5D; d5 = ((double)random.nextFloat() - 0.5D) * 0.5D; if (world.getBlock(x - 1, y, z) != this && world.getBlock(x + 1, y, z) != this) { d0 = (double)x + 0.5D + 0.25D * (double)i1; d3 = (double)(random.nextFloat() * 2.0F * (float)i1); } else { d2 = (double)z + 0.5D + 0.25D * (double)i1; d5 = (double)(random.nextFloat() * 2.0F * (float)i1); } world.spawnParticle("cloud", d0, d1, d2, d3, d4, d5); } } @SideOnly(Side.CLIENT) public int idPicked(World world, int x, int y, int z) { return 0; }
  12. I know that will work with my own custom block but how would I use it with a vanilla block?
  13. How would I change a vanilla texture based on its height in the world? Example: Coal ore will have a different texture at Y 128 opposed to Y 32.
  14. I've been messing around with the "getDrops" method and I cannot figure out how to do it.
  15. How would I make a Metadata block drop another Metadata block?
  16. How would I make a block drop if it is surrounded by an air block on all six sides?
×
×
  • Create New...

Important Information

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