-
Posts
307 -
Joined
-
Last visited
Everything posted by Tschipp
-
[1.10.2] See-through glass-like block acts as an x-ray, help needed
Tschipp replied to hhggtg3279's topic in Modder Support
You need to extend BlockGlass, getBlockLayer() doesn't override anything. Try to add the @Override annotation to every method that you want to override, it prevents errors. EDIT: Nevermind, getBlockLayer is part of the Block class... try extending BlockGlass anyways. -
[1.8.9] Weird Problems with custom Dimension [SOLVED]
Tschipp replied to Tschipp's topic in Modder Support
I might've overlooked, but I think entityIn.func_181014_aG() isn't called before that line, making it the possible issue. You were right, entityIn.func_181014_aG() returns the Vec3 field_181017_ao which is actually null at the time... What can I do? I have no Idea what that field corresponds to. -
[1.8.9] Weird Problems with custom Dimension [SOLVED]
Tschipp replied to Tschipp's topic in Modder Support
I added a comment under where it errors. Also I have no Idea what most of the variables do, so I'm a bit lost... -
[1.8.9] Weird Problems with custom Dimension [SOLVED]
Tschipp replied to Tschipp's topic in Modder Support
I seem to be getting a null pointer: java.util.concurrent.ExecutionException: net.minecraft.util.ReportedException: Colliding entity with block at java.util.concurrent.FutureTask.report(FutureTask.java:122) ~[?:1.8.0_65] at java.util.concurrent.FutureTask.get(FutureTask.java:192) ~[?:1.8.0_65] at net.minecraft.util.Util.runTask(Util.java:23) [util.class:?] at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:736) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:681) [MinecraftServer.class:?] at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:159) [integratedServer.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:548) [MinecraftServer.class:?] at java.lang.Thread.run(Thread.java:745) [?:1.8.0_65] Caused by: net.minecraft.util.ReportedException: Colliding entity with block at net.minecraft.entity.player.EntityPlayerMP.onUpdateEntity(EntityPlayerMP.java:417) ~[EntityPlayerMP.class:?] at net.minecraft.network.NetHandlerPlayServer.processPlayer(NetHandlerPlayServer.java:347) ~[NetHandlerPlayServer.class:?] at net.minecraft.network.play.client.C03PacketPlayer.processPacket(C03PacketPlayer.java:36) ~[C03PacketPlayer.class:?] at net.minecraft.network.play.client.C03PacketPlayer$C06PacketPlayerPosLook.processPacket(C03PacketPlayer.java:177) ~[C03PacketPlayer$C06PacketPlayerPosLook.class:?] at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:15) ~[PacketThreadUtil$1.class:?] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[?:1.8.0_65] at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_65] at net.minecraft.util.Util.runTask(Util.java:22) ~[util.class:?] ... 5 more Caused by: java.lang.NullPointerException at tschipp.bedrockium.dimension.TeleporterBedrockium.placeInExistingPortal(TeleporterBedrockium.java:158) ~[TeleporterBedrockium.class:?] at tschipp.bedrockium.dimension.TeleporterBedrockium.placeInPortal(TeleporterBedrockium.java:44) ~[TeleporterBedrockium.class:?] at net.minecraft.server.management.ServerConfigurationManager.transferEntityToWorld(ServerConfigurationManager.java:663) ~[serverConfigurationManager.class:?] at net.minecraft.server.management.ServerConfigurationManager.transferPlayerToDimension(ServerConfigurationManager.java:571) ~[serverConfigurationManager.class:?] at tschipp.bedrockium.blocks.BedrockiumPortal.onEntityCollidedWithBlock(BedrockiumPortal.java:61) ~[bedrockiumPortal.class:?] at net.minecraft.entity.Entity.doBlockCollisions(Entity.java:917) ~[Entity.class:?] at net.minecraft.entity.Entity.moveEntity(Entity.java:843) ~[Entity.class:?] at net.minecraft.entity.EntityLivingBase.moveEntityWithHeading(EntityLivingBase.java:1644) ~[EntityLivingBase.class:?] at net.minecraft.entity.player.EntityPlayer.moveEntityWithHeading(EntityPlayer.java:1868) ~[EntityPlayer.class:?] at net.minecraft.entity.EntityLivingBase.onLivingUpdate(EntityLivingBase.java:2022) ~[EntityLivingBase.class:?] at net.minecraft.entity.player.EntityPlayer.onLivingUpdate(EntityPlayer.java:613) ~[EntityPlayer.class:?] at net.minecraft.entity.EntityLivingBase.onUpdate(EntityLivingBase.java:1824) ~[EntityLivingBase.class:?] at net.minecraft.entity.player.EntityPlayer.onUpdate(EntityPlayer.java:323) ~[EntityPlayer.class:?] at net.minecraft.entity.player.EntityPlayerMP.onUpdateEntity(EntityPlayerMP.java:366) ~[EntityPlayerMP.class:?] at net.minecraft.network.NetHandlerPlayServer.processPlayer(NetHandlerPlayServer.java:347) ~[NetHandlerPlayServer.class:?] at net.minecraft.network.play.client.C03PacketPlayer.processPacket(C03PacketPlayer.java:36) ~[C03PacketPlayer.class:?] at net.minecraft.network.play.client.C03PacketPlayer$C06PacketPlayerPosLook.processPacket(C03PacketPlayer.java:177) ~[C03PacketPlayer$C06PacketPlayerPosLook.class:?] at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:15) ~[PacketThreadUtil$1.class:?] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[?:1.8.0_65] at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_65] at net.minecraft.util.Util.runTask(Util.java:22) ~[util.class:?] ... 5 more[/Code] That is here in my Teleporter Class: [Code]@Override public boolean placeInExistingPortal(Entity entityIn, float rotationYaw) { int i = 128; double d0 = -1.0D; int j = MathHelper.floor_double(entityIn.posX); int k = MathHelper.floor_double(entityIn.posZ); boolean flag = true; BlockPos blockpos = BlockPos.ORIGIN; long l = ChunkCoordIntPair.chunkXZ2Int(j, k); if (this.destinationCoordinateCache.containsItem(l)) { TeleporterBedrockium.PortalPosition teleporter$portalposition = (TeleporterBedrockium.PortalPosition)this.destinationCoordinateCache.getValueByKey(l); d0 = 0.0D; blockpos = teleporter$portalposition; teleporter$portalposition.lastUpdateTime = this.worldServerInstance.getTotalWorldTime(); flag = false; } else { BlockPos blockpos3 = new BlockPos(entityIn); for (int i1 = -128; i1 <= 128; ++i1) { BlockPos blockpos2; for (int j1 = -128; j1 <= 128; ++j1) { for (BlockPos blockpos1 = blockpos3.add(i1, this.worldServerInstance.getActualHeight() - 1 - blockpos3.getY(), j1); blockpos1.getY() >= 0; blockpos1 = blockpos2) { blockpos2 = blockpos1.down(); if (this.worldServerInstance.getBlockState(blockpos1).getBlock() == BedrockiumBlocks.bedrockiumPortal) { while (this.worldServerInstance.getBlockState(blockpos2 = blockpos1.down()).getBlock() == BedrockiumBlocks.bedrockiumPortal) { blockpos1 = blockpos2; } double d1 = blockpos1.distanceSq(blockpos3); if (d0 < 0.0D || d1 < d0) { d0 = d1; blockpos = blockpos1; } } } } } } if (d0 >= 0.0D) { if (flag) { this.destinationCoordinateCache.add(l, new TeleporterBedrockium.PortalPosition(blockpos, this.worldServerInstance.getTotalWorldTime())); this.destinationCoordinateKeys.add(Long.valueOf(l)); } double d5 = (double)blockpos.getX() + 0.5D; double d6 = (double)blockpos.getY() + 0.5D; double d7 = (double)blockpos.getZ() + 0.5D; BlockPattern.PatternHelper blockpattern$patternhelper = BedrockiumBlocks.bedrockiumPortal.func_181089_f(this.worldServerInstance, blockpos); boolean flag1 = blockpattern$patternhelper.getFinger().rotateY().getAxisDirection() == EnumFacing.AxisDirection.NEGATIVE; double d2 = blockpattern$patternhelper.getFinger().getAxis() == EnumFacing.Axis.X ? (double)blockpattern$patternhelper.func_181117_a().getZ() : (double)blockpattern$patternhelper.func_181117_a().getX(); d6 = (double)(blockpattern$patternhelper.func_181117_a().getY() + 1) - entityIn.func_181014_aG().yCoord * (double)blockpattern$patternhelper.func_181119_e(); //Null Pointer here! if (flag1) { ++d2; } if (blockpattern$patternhelper.getFinger().getAxis() == EnumFacing.Axis.X) { d7 = d2 + (1.0D - entityIn.func_181014_aG().xCoord) * (double)blockpattern$patternhelper.func_181118_d() * (double)blockpattern$patternhelper.getFinger().rotateY().getAxisDirection().getOffset(); } else { d5 = d2 + (1.0D - entityIn.func_181014_aG().xCoord) * (double)blockpattern$patternhelper.func_181118_d() * (double)blockpattern$patternhelper.getFinger().rotateY().getAxisDirection().getOffset(); } float f = 0.0F; float f1 = 0.0F; float f2 = 0.0F; float f3 = 0.0F; if (blockpattern$patternhelper.getFinger().getOpposite() == entityIn.func_181012_aH()) { f = 1.0F; f1 = 1.0F; } else if (blockpattern$patternhelper.getFinger().getOpposite() == entityIn.func_181012_aH().getOpposite()) { f = -1.0F; f1 = -1.0F; } else if (blockpattern$patternhelper.getFinger().getOpposite() == entityIn.func_181012_aH().rotateY()) { f2 = 1.0F; f3 = -1.0F; } else { f2 = -1.0F; f3 = 1.0F; } double d3 = entityIn.motionX; double d4 = entityIn.motionZ; entityIn.motionX = d3 * (double)f + d4 * (double)f3; entityIn.motionZ = d3 * (double)f2 + d4 * (double)f1; entityIn.rotationYaw = rotationYaw - (float)(entityIn.func_181012_aH().getOpposite().getHorizontalIndex() * 90) + (float)(blockpattern$patternhelper.getFinger().getHorizontalIndex() * 90); entityIn.setLocationAndAngles(d5, d6, d7, entityIn.rotationYaw, entityIn.rotationPitch); return true; } else { return false; } }[/Code] -
[1.8.9] Weird Problems with custom Dimension [SOLVED]
Tschipp replied to Tschipp's topic in Modder Support
I just would like to add that it sort of works now, but the dimension doesn't load when entering the first time. I need to reconnect for it to start loading. Same with when I go back from the dimension. -
[1.8.9] Weird Problems with custom Dimension [SOLVED]
Tschipp replied to Tschipp's topic in Modder Support
I did that, but I can't find anything abnormal. In fact, I can't even find anything in the teleporter class that says to what dimension it should teleport the player anyway... -
[1.8.9] Weird Problems with custom Dimension [SOLVED]
Tschipp replied to Tschipp's topic in Modder Support
Well it sort of works now, but when I enter the portal I get briefly teleported to my dimension, but then I get instantly teleported to the nether again -
[1.8.9] Weird Problems with custom Dimension [SOLVED]
Tschipp replied to Tschipp's topic in Modder Support
I tried that, it doesn't make a difference. The Dimension works, i have visited it already (using McEdit). I register it like this in the init method of my main mod class: DimensionManager.registerProviderType(dimensionIdBedrockium, WorldProviderBedrockium.class, false); DimensionManager.registerDimension(dimensionIdBedrockium, dimensionIdBedrockium); -
I "made" a teleporter class and a BlockPortal class (basically copied it because I have no Idea what's going on nor did I find any good tutorials). My problem is that the Portal Block teleports me to the nether instead of my Dimension. Where did I mess up? My "Portal Frame" Block is called slimyBedrockium, my portal block bedrockiumPortal. EDIT: I have one more Problem: The dimension doesn't get loaded when entering the portal for the first time. If I want it to load, I need to reconnect to the world. (I usually then spawn somewhere in the ground). The same thing happens when I go back to the Overworld... This is my Teleporter Class: package tschipp.bedrockium.dimension; import java.util.Iterator; import java.util.List; import java.util.Random; import net.minecraft.block.BlockPortal; import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.pattern.BlockPattern; import net.minecraft.entity.Entity; import net.minecraft.init.Blocks; import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.LongHashMap; import net.minecraft.util.MathHelper; import net.minecraft.world.ChunkCoordIntPair; import net.minecraft.world.Teleporter; import net.minecraft.world.WorldServer; import tschipp.bedrockium.BedrockiumMod; import tschipp.bedrockium.blocks.BedrockiumBlocks; import com.google.common.collect.Lists; public class TeleporterBedrockium extends Teleporter { private final WorldServer worldServerInstance; /** A private Random() function in Teleporter */ private final Random random; private final LongHashMap<TeleporterBedrockium.PortalPosition> destinationCoordinateCache = new LongHashMap(); private final List<Long> destinationCoordinateKeys = Lists.<Long>newArrayList(); public TeleporterBedrockium(WorldServer worldIn) { super(worldIn); this.worldServerInstance = worldIn; this.random = new Random(worldIn.getSeed()); } @Override public void placeInPortal(Entity entityIn, float rotationYaw) { if (this.worldServerInstance.provider.getDimensionId() != 1) { if (!this.placeInExistingPortal(entityIn, rotationYaw)) { this.makePortal(entityIn); this.placeInExistingPortal(entityIn, rotationYaw); } } else { int i = MathHelper.floor_double(entityIn.posX); int j = MathHelper.floor_double(entityIn.posY) - 1; int k = MathHelper.floor_double(entityIn.posZ); int l = 1; int i1 = 0; for (int j1 = -2; j1 <= 2; ++j1) { for (int k1 = -2; k1 <= 2; ++k1) { for (int l1 = -1; l1 < 3; ++l1) { int i2 = i + k1 * l + j1 * i1; int j2 = j + l1; int k2 = k + k1 * i1 - j1 * l; boolean flag = l1 < 0; this.worldServerInstance.setBlockState(new BlockPos(i2, j2, k2), flag ? BedrockiumBlocks.slimyBedrockium.getDefaultState() : Blocks.air.getDefaultState()); } } } entityIn.setLocationAndAngles((double)i, (double)j, (double)k, entityIn.rotationYaw, 0.0F); entityIn.motionX = entityIn.motionY = entityIn.motionZ = 0.0D; } } @Override public boolean placeInExistingPortal(Entity entityIn, float rotationYaw) { int i = 128; double d0 = -1.0D; int j = MathHelper.floor_double(entityIn.posX); int k = MathHelper.floor_double(entityIn.posZ); boolean flag = true; BlockPos blockpos = BlockPos.ORIGIN; long l = ChunkCoordIntPair.chunkXZ2Int(j, k); if (this.destinationCoordinateCache.containsItem(l)) { TeleporterBedrockium.PortalPosition teleporter$portalposition = (TeleporterBedrockium.PortalPosition)this.destinationCoordinateCache.getValueByKey(l); d0 = 0.0D; blockpos = teleporter$portalposition; teleporter$portalposition.lastUpdateTime = this.worldServerInstance.getTotalWorldTime(); flag = false; } else { BlockPos blockpos3 = new BlockPos(entityIn); for (int i1 = -128; i1 <= 128; ++i1) { BlockPos blockpos2; for (int j1 = -128; j1 <= 128; ++j1) { for (BlockPos blockpos1 = blockpos3.add(i1, this.worldServerInstance.getActualHeight() - 1 - blockpos3.getY(), j1); blockpos1.getY() >= 0; blockpos1 = blockpos2) { blockpos2 = blockpos1.down(); if (this.worldServerInstance.getBlockState(blockpos1).getBlock() == BedrockiumBlocks.bedrockiumPortal) { while (this.worldServerInstance.getBlockState(blockpos2 = blockpos1.down()).getBlock() == BedrockiumBlocks.bedrockiumPortal) { blockpos1 = blockpos2; } double d1 = blockpos1.distanceSq(blockpos3); if (d0 < 0.0D || d1 < d0) { d0 = d1; blockpos = blockpos1; } } } } } } if (d0 >= 0.0D) { if (flag) { this.destinationCoordinateCache.add(l, new TeleporterBedrockium.PortalPosition(blockpos, this.worldServerInstance.getTotalWorldTime())); this.destinationCoordinateKeys.add(Long.valueOf(l)); } double d5 = (double)blockpos.getX() + 0.5D; double d6 = (double)blockpos.getY() + 0.5D; double d7 = (double)blockpos.getZ() + 0.5D; BlockPattern.PatternHelper blockpattern$patternhelper = BedrockiumBlocks.bedrockiumPortal.func_181089_f(this.worldServerInstance, blockpos); boolean flag1 = blockpattern$patternhelper.getFinger().rotateY().getAxisDirection() == EnumFacing.AxisDirection.NEGATIVE; double d2 = blockpattern$patternhelper.getFinger().getAxis() == EnumFacing.Axis.X ? (double)blockpattern$patternhelper.func_181117_a().getZ() : (double)blockpattern$patternhelper.func_181117_a().getX(); d6 = (double)(blockpattern$patternhelper.func_181117_a().getY() + 1) - entityIn.func_181014_aG().yCoord * (double)blockpattern$patternhelper.func_181119_e(); if (flag1) { ++d2; } if (blockpattern$patternhelper.getFinger().getAxis() == EnumFacing.Axis.X) { d7 = d2 + (1.0D - entityIn.func_181014_aG().xCoord) * (double)blockpattern$patternhelper.func_181118_d() * (double)blockpattern$patternhelper.getFinger().rotateY().getAxisDirection().getOffset(); } else { d5 = d2 + (1.0D - entityIn.func_181014_aG().xCoord) * (double)blockpattern$patternhelper.func_181118_d() * (double)blockpattern$patternhelper.getFinger().rotateY().getAxisDirection().getOffset(); } float f = 0.0F; float f1 = 0.0F; float f2 = 0.0F; float f3 = 0.0F; if (blockpattern$patternhelper.getFinger().getOpposite() == entityIn.func_181012_aH()) { f = 1.0F; f1 = 1.0F; } else if (blockpattern$patternhelper.getFinger().getOpposite() == entityIn.func_181012_aH().getOpposite()) { f = -1.0F; f1 = -1.0F; } else if (blockpattern$patternhelper.getFinger().getOpposite() == entityIn.func_181012_aH().rotateY()) { f2 = 1.0F; f3 = -1.0F; } else { f2 = -1.0F; f3 = 1.0F; } double d3 = entityIn.motionX; double d4 = entityIn.motionZ; entityIn.motionX = d3 * (double)f + d4 * (double)f3; entityIn.motionZ = d3 * (double)f2 + d4 * (double)f1; entityIn.rotationYaw = rotationYaw - (float)(entityIn.func_181012_aH().getOpposite().getHorizontalIndex() * 90) + (float)(blockpattern$patternhelper.getFinger().getHorizontalIndex() * 90); entityIn.setLocationAndAngles(d5, d6, d7, entityIn.rotationYaw, entityIn.rotationPitch); return true; } else { return false; } } @Override public boolean makePortal(Entity entity) { int i = 16; double d0 = -1.0D; int j = MathHelper.floor_double(entity.posX); int k = MathHelper.floor_double(entity.posY); int l = MathHelper.floor_double(entity.posZ); int i1 = j; int j1 = k; int k1 = l; int l1 = 0; int i2 = this.random.nextInt(4); BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); for (int j2 = j - i; j2 <= j + i; ++j2) { double d1 = (double)j2 + 0.5D - entity.posX; for (int l2 = l - i; l2 <= l + i; ++l2) { double d2 = (double)l2 + 0.5D - entity.posZ; label142: for (int j3 = this.worldServerInstance.getActualHeight() - 1; j3 >= 0; --j3) { if (this.worldServerInstance.isAirBlock(blockpos$mutableblockpos.set(j2, j3, l2))) { while (j3 > 0 && this.worldServerInstance.isAirBlock(blockpos$mutableblockpos.set(j2, j3 - 1, l2))) { --j3; } for (int k3 = i2; k3 < i2 + 4; ++k3) { int l3 = k3 % 2; int i4 = 1 - l3; if (k3 % 4 >= 2) { l3 = -l3; i4 = -i4; } for (int j4 = 0; j4 < 3; ++j4) { for (int k4 = 0; k4 < 4; ++k4) { for (int l4 = -1; l4 < 4; ++l4) { int i5 = j2 + (k4 - 1) * l3 + j4 * i4; int j5 = j3 + l4; int k5 = l2 + (k4 - 1) * i4 - j4 * l3; blockpos$mutableblockpos.set(i5, j5, k5); if (l4 < 0 && !this.worldServerInstance.getBlockState(blockpos$mutableblockpos).getBlock().getMaterial().isSolid() || l4 >= 0 && !this.worldServerInstance.isAirBlock(blockpos$mutableblockpos)) { continue label142; } } } } double d5 = (double)j3 + 0.5D - entity.posY; double d7 = d1 * d1 + d5 * d5 + d2 * d2; if (d0 < 0.0D || d7 < d0) { d0 = d7; i1 = j2; j1 = j3; k1 = l2; l1 = k3 % 4; } } } } } } if (d0 < 0.0D) { for (int l5 = j - i; l5 <= j + i; ++l5) { double d3 = (double)l5 + 0.5D - entity.posX; for (int j6 = l - i; j6 <= l + i; ++j6) { double d4 = (double)j6 + 0.5D - entity.posZ; label562: for (int i7 = this.worldServerInstance.getActualHeight() - 1; i7 >= 0; --i7) { if (this.worldServerInstance.isAirBlock(blockpos$mutableblockpos.set(l5, i7, j6))) { while (i7 > 0 && this.worldServerInstance.isAirBlock(blockpos$mutableblockpos.set(l5, i7 - 1, j6))) { --i7; } for (int k7 = i2; k7 < i2 + 2; ++k7) { int j8 = k7 % 2; int j9 = 1 - j8; for (int j10 = 0; j10 < 4; ++j10) { for (int j11 = -1; j11 < 4; ++j11) { int j12 = l5 + (j10 - 1) * j8; int i13 = i7 + j11; int j13 = j6 + (j10 - 1) * j9; blockpos$mutableblockpos.set(j12, i13, j13); if (j11 < 0 && !this.worldServerInstance.getBlockState(blockpos$mutableblockpos).getBlock().getMaterial().isSolid() || j11 >= 0 && !this.worldServerInstance.isAirBlock(blockpos$mutableblockpos)) { continue label562; } } } double d6 = (double)i7 + 0.5D - entity.posY; double d8 = d3 * d3 + d6 * d6 + d4 * d4; if (d0 < 0.0D || d8 < d0) { d0 = d8; i1 = l5; j1 = i7; k1 = j6; l1 = k7 % 2; } } } } } } } int i6 = i1; int k2 = j1; int k6 = k1; int l6 = l1 % 2; int i3 = 1 - l6; if (l1 % 4 >= 2) { l6 = -l6; i3 = -i3; } if (d0 < 0.0D) { j1 = MathHelper.clamp_int(j1, 70, this.worldServerInstance.getActualHeight() - 10); k2 = j1; for (int j7 = -1; j7 <= 1; ++j7) { for (int l7 = 1; l7 < 3; ++l7) { for (int k8 = -1; k8 < 3; ++k8) { int k9 = i6 + (l7 - 1) * l6 + j7 * i3; int k10 = k2 + k8; int k11 = k6 + (l7 - 1) * i3 - j7 * l6; boolean flag = k8 < 0; this.worldServerInstance.setBlockState(new BlockPos(k9, k10, k11), flag ? BedrockiumBlocks.slimyBedrockium.getDefaultState() : Blocks.air.getDefaultState()); } } } } IBlockState iblockstate = BedrockiumBlocks.bedrockiumPortal.getDefaultState().withProperty(BlockPortal.AXIS, l6 != 0 ? EnumFacing.Axis.X : EnumFacing.Axis.Z); for (int i8 = 0; i8 < 4; ++i8) { for (int l8 = 0; l8 < 4; ++l8) { for (int l9 = -1; l9 < 4; ++l9) { int l10 = i6 + (l8 - 1) * l6; int l11 = k2 + l9; int k12 = k6 + (l8 - 1) * i3; boolean flag1 = l8 == 0 || l8 == 3 || l9 == -1 || l9 == 3; this.worldServerInstance.setBlockState(new BlockPos(l10, l11, k12), flag1 ? BedrockiumBlocks.slimyBedrockium.getDefaultState() : iblockstate, 2); } } for (int i9 = 0; i9 < 4; ++i9) { for (int i10 = -1; i10 < 4; ++i10) { int i11 = i6 + (i9 - 1) * l6; int i12 = k2 + i10; int l12 = k6 + (i9 - 1) * i3; BlockPos blockpos = new BlockPos(i11, i12, l12); this.worldServerInstance.notifyNeighborsOfStateChange(blockpos, this.worldServerInstance.getBlockState(blockpos).getBlock()); } } } return true; } /** * called periodically to remove out-of-date portal locations from the cache list. Argument par1 is a * WorldServer.getTotalWorldTime() value. */ @Override public void removeStalePortalLocations(long worldTime) { if (worldTime % 100L == 0L) { Iterator<Long> iterator = this.destinationCoordinateKeys.iterator(); long i = worldTime - 300L; while (iterator.hasNext()) { Long olong = (Long)iterator.next(); TeleporterBedrockium.PortalPosition teleporter$portalposition = (TeleporterBedrockium.PortalPosition)this.destinationCoordinateCache.getValueByKey(olong.longValue()); if (teleporter$portalposition == null || teleporter$portalposition.lastUpdateTime < i) { iterator.remove(); this.destinationCoordinateCache.remove(olong.longValue()); } } } } public class PortalPosition extends BlockPos { /** The worldtime at which this PortalPosition was last verified */ public long lastUpdateTime; public PortalPosition(BlockPos pos, long lastUpdate) { super(pos.getX(), pos.getY(), pos.getZ()); this.lastUpdateTime = lastUpdate; } } } And this is my Portal Block class: package tschipp.bedrockium.blocks; import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.BlockPortal; import net.minecraft.block.material.MapColor; import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyEnum; import net.minecraft.block.state.BlockState; import net.minecraft.block.state.BlockWorldState; import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.pattern.BlockPattern; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemMonsterPlacer; import net.minecraft.server.MinecraftServer; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.EnumWorldBlockLayer; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import tschipp.bedrockium.BedrockiumMod; import tschipp.bedrockium.dimension.TeleporterBedrockium; import com.google.common.cache.LoadingCache; public class BedrockiumPortal extends BlockPortal { public static final PropertyEnum<EnumFacing.Axis> AXIS = PropertyEnum.<EnumFacing.Axis>create("axis", EnumFacing.Axis.class, new EnumFacing.Axis[] {EnumFacing.Axis.X, EnumFacing.Axis.Z}); public BedrockiumPortal() { super(); this.setDefaultState(this.blockState.getBaseState().withProperty(AXIS, EnumFacing.Axis.X)); this.setTickRandomly(true); this.setUnlocalizedName("bedrockiumPortal"); this.setStepSound(soundTypeGlass); this.setBlockUnbreakable(); this.setResistance(5000F); } @Override public void onEntityCollidedWithBlock(World world, BlockPos pos, Entity entity) { if(entity.ridingEntity == null && entity.riddenByEntity == null && entity instanceof EntityPlayerMP) { EntityPlayerMP player = (EntityPlayerMP) entity; FMLCommonHandler.instance().getMinecraftServerInstance(); MinecraftServer server = MinecraftServer.getServer(); if(player.timeUntilPortal > 0) { player.timeUntilPortal = 10; } else if(player.dimension != BedrockiumMod.dimensionIdBedrockium) { player.timeUntilPortal = 10; player.mcServer.getConfigurationManager().transferPlayerToDimension(player, BedrockiumMod.dimensionIdBedrockium, new TeleporterBedrockium(server.worldServerForDimension(BedrockiumMod.dimensionIdBedrockium))); }else { player.timeUntilPortal = 10; player.mcServer.getConfigurationManager().transferPlayerToDimension(player, 0, new TeleporterBedrockium(server.worldServerForDimension(0))); } } } @Override public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ) { if(player instanceof EntityPlayerMP) { ((EntityPlayerMP)player).mcServer.getConfigurationManager().transferPlayerToDimension((EntityPlayerMP) player, BedrockiumMod.dimensionIdBedrockium, new TeleporterBedrockium(MinecraftServer.getServer().worldServerForDimension(BedrockiumMod.dimensionIdBedrockium))); } return true; } @Override public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) { super.updateTick(worldIn, pos, state, rand); if (worldIn.provider.isSurfaceWorld() && worldIn.getGameRules().getBoolean("doMobSpawning") && rand.nextInt(2000) < worldIn.getDifficulty().getDifficultyId()) { int i = pos.getY(); BlockPos blockpos; for (blockpos = pos; !World.doesBlockHaveSolidTopSurface(worldIn, blockpos) && blockpos.getY() > 0; blockpos = blockpos.down()) { ; } if (i > 0 && !worldIn.getBlockState(blockpos.up()).getBlock().isNormalCube()) { Entity entity = ItemMonsterPlacer.spawnCreature(worldIn, 58, (double)blockpos.getX() + 0.5D, (double)blockpos.getY() + 1.1D, (double)blockpos.getZ() + 0.5D); if (entity != null) { entity.timeUntilPortal = entity.getPortalCooldown(); } } } } @Override public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos) { EnumFacing.Axis enumfacing$axis = (EnumFacing.Axis)worldIn.getBlockState(pos).getValue(AXIS); float f = 0.125F; float f1 = 0.125F; if (enumfacing$axis == EnumFacing.Axis.X) { f = 0.5F; } if (enumfacing$axis == EnumFacing.Axis.Z) { f1 = 0.5F; } this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f1, 0.5F + f, 1.0F, 0.5F + f1); } public static int getMetaForAxis(EnumFacing.Axis axis) { return axis == EnumFacing.Axis.X ? 1 : (axis == EnumFacing.Axis.Z ? 2 : 0); } @Override public boolean isFullCube() { return false; } public boolean func_176548_d(World worldIn, BlockPos p_176548_2_) { BedrockiumPortal.Size blockportal$size = new BedrockiumPortal.Size(worldIn, p_176548_2_, EnumFacing.Axis.X); if (blockportal$size.func_150860_b() && blockportal$size.field_150864_e == 0) { blockportal$size.func_150859_c(); return true; } else { BedrockiumPortal.Size blockportal$size1 = new BedrockiumPortal.Size(worldIn, p_176548_2_, EnumFacing.Axis.Z); if (blockportal$size1.func_150860_b() && blockportal$size1.field_150864_e == 0) { blockportal$size1.func_150859_c(); return true; } else { return false; } } } /** * Called when a neighboring block changes. */ @Override public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) { EnumFacing.Axis enumfacing$axis = (EnumFacing.Axis)state.getValue(AXIS); if (enumfacing$axis == EnumFacing.Axis.X) { BedrockiumPortal.Size blockportal$size = new BedrockiumPortal.Size(worldIn, pos, EnumFacing.Axis.X); if (!blockportal$size.func_150860_b() || blockportal$size.field_150864_e < blockportal$size.field_150868_h * blockportal$size.field_150862_g) { worldIn.setBlockState(pos, Blocks.air.getDefaultState()); } } else if (enumfacing$axis == EnumFacing.Axis.Z) { BedrockiumPortal.Size blockportal$size1 = new BedrockiumPortal.Size(worldIn, pos, EnumFacing.Axis.Z); if (!blockportal$size1.func_150860_b() || blockportal$size1.field_150864_e < blockportal$size1.field_150868_h * blockportal$size1.field_150862_g) { worldIn.setBlockState(pos, Blocks.air.getDefaultState()); } } } @Override @SideOnly(Side.CLIENT) public boolean shouldSideBeRendered(IBlockAccess worldIn, BlockPos pos, EnumFacing side) { EnumFacing.Axis enumfacing$axis = null; IBlockState iblockstate = worldIn.getBlockState(pos); if (worldIn.getBlockState(pos).getBlock() == this) { enumfacing$axis = (EnumFacing.Axis)iblockstate.getValue(AXIS); if (enumfacing$axis == null) { return false; } if (enumfacing$axis == EnumFacing.Axis.Z && side != EnumFacing.EAST && side != EnumFacing.WEST) { return false; } if (enumfacing$axis == EnumFacing.Axis.X && side != EnumFacing.SOUTH && side != EnumFacing.NORTH) { return false; } } boolean flag = worldIn.getBlockState(pos.west()).getBlock() == this && worldIn.getBlockState(pos.west(2)).getBlock() != this; boolean flag1 = worldIn.getBlockState(pos.east()).getBlock() == this && worldIn.getBlockState(pos.east(2)).getBlock() != this; boolean flag2 = worldIn.getBlockState(pos.north()).getBlock() == this && worldIn.getBlockState(pos.north(2)).getBlock() != this; boolean flag3 = worldIn.getBlockState(pos.south()).getBlock() == this && worldIn.getBlockState(pos.south(2)).getBlock() != this; boolean flag4 = flag || flag1 || enumfacing$axis == EnumFacing.Axis.X; boolean flag5 = flag2 || flag3 || enumfacing$axis == EnumFacing.Axis.Z; return flag4 && side == EnumFacing.WEST ? true : (flag4 && side == EnumFacing.EAST ? true : (flag5 && side == EnumFacing.NORTH ? true : flag5 && side == EnumFacing.SOUTH)); } /** * Returns the quantity of items to drop on block destruction. */ @Override public int quantityDropped(Random random) { return 0; } /** * Called When an Entity Collided with the Block */ /** * Convert the given metadata into a BlockState for this Block */ @Override public IBlockState getStateFromMeta(int meta) { return this.getDefaultState().withProperty(AXIS, (meta & 3) == 2 ? EnumFacing.Axis.Z : EnumFacing.Axis.X); } @Override @SideOnly(Side.CLIENT) public EnumWorldBlockLayer getBlockLayer() { return EnumWorldBlockLayer.TRANSLUCENT; } @Override @SideOnly(Side.CLIENT) public void randomDisplayTick(World worldIn, BlockPos pos, IBlockState state, Random rand) { if (rand.nextInt(100) == 0) { worldIn.playSound((double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, "portal.portal", 0.5F, rand.nextFloat() * 0.4F + 0.8F, false); } for (int i = 0; i < 4; ++i) { double d0 = (double)((float)pos.getX() + rand.nextFloat()); double d1 = (double)((float)pos.getY() + rand.nextFloat()); double d2 = (double)((float)pos.getZ() + rand.nextFloat()); double d3 = ((double)rand.nextFloat() - 0.5D) * 0.5D; double d4 = ((double)rand.nextFloat() - 0.5D) * 0.5D; double d5 = ((double)rand.nextFloat() - 0.5D) * 0.5D; int j = rand.nextInt(2) * 2 - 1; if (worldIn.getBlockState(pos.west()).getBlock() != this && worldIn.getBlockState(pos.east()).getBlock() != this) { d0 = (double)pos.getX() + 0.5D + 0.25D * (double)j; d3 = (double)(rand.nextFloat() * 2.0F * (float)j); } else { d2 = (double)pos.getZ() + 0.5D + 0.25D * (double)j; d5 = (double)(rand.nextFloat() * 2.0F * (float)j); } worldIn.spawnParticle(EnumParticleTypes.PORTAL, d0, d1, d2, d3, d4, d5, new int[0]); } } @Override @SideOnly(Side.CLIENT) public Item getItem(World worldIn, BlockPos pos) { return null; } /** * Convert the BlockState into the correct metadata value */ @Override public int getMetaFromState(IBlockState state) { return getMetaForAxis((EnumFacing.Axis)state.getValue(AXIS)); } @Override protected BlockState createBlockState() { return new BlockState(this, new IProperty[] {AXIS}); } public BlockPattern.PatternHelper func_181089_f(World world, BlockPos pos) { EnumFacing.Axis enumfacing$axis = EnumFacing.Axis.Z; BedrockiumPortal.Size blockportal$size = new BedrockiumPortal.Size(world, pos, EnumFacing.Axis.X); LoadingCache<BlockPos, BlockWorldState> loadingcache = BlockPattern.func_181627_a(world, true); if (!blockportal$size.func_150860_b()) { enumfacing$axis = EnumFacing.Axis.X; blockportal$size = new BedrockiumPortal.Size(world, pos, EnumFacing.Axis.Z); } if (!blockportal$size.func_150860_b()) { return new BlockPattern.PatternHelper(pos, EnumFacing.NORTH, EnumFacing.UP, loadingcache, 1, 1, 1); } else { int[] aint = new int[EnumFacing.AxisDirection.values().length]; EnumFacing enumfacing = blockportal$size.field_150866_c.rotateYCCW(); BlockPos blockpos = blockportal$size.field_150861_f.up(blockportal$size.func_181100_a() - 1); for (EnumFacing.AxisDirection enumfacing$axisdirection : EnumFacing.AxisDirection.values()) { BlockPattern.PatternHelper blockpattern$patternhelper = new BlockPattern.PatternHelper(enumfacing.getAxisDirection() == enumfacing$axisdirection ? blockpos : blockpos.offset(blockportal$size.field_150866_c, blockportal$size.func_181101_b() - 1), EnumFacing.func_181076_a(enumfacing$axisdirection, enumfacing$axis), EnumFacing.UP, loadingcache, blockportal$size.func_181101_b(), blockportal$size.func_181100_a(), 1); for (int i = 0; i < blockportal$size.func_181101_b(); ++i) { for (int j = 0; j < blockportal$size.func_181100_a(); ++j) { BlockWorldState blockworldstate = blockpattern$patternhelper.translateOffset(i, j, 1); if (blockworldstate.getBlockState() != null && blockworldstate.getBlockState().getBlock().getMaterial() != Material.air) { ++aint[enumfacing$axisdirection.ordinal()]; } } } } EnumFacing.AxisDirection enumfacing$axisdirection1 = EnumFacing.AxisDirection.POSITIVE; for (EnumFacing.AxisDirection enumfacing$axisdirection2 : EnumFacing.AxisDirection.values()) { if (aint[enumfacing$axisdirection2.ordinal()] < aint[enumfacing$axisdirection1.ordinal()]) { enumfacing$axisdirection1 = enumfacing$axisdirection2; } } return new BlockPattern.PatternHelper(enumfacing.getAxisDirection() == enumfacing$axisdirection1 ? blockpos : blockpos.offset(blockportal$size.field_150866_c, blockportal$size.func_181101_b() - 1), EnumFacing.func_181076_a(enumfacing$axisdirection1, enumfacing$axis), EnumFacing.UP, loadingcache, blockportal$size.func_181101_b(), blockportal$size.func_181100_a(), 1); } } public static class Size { private final World world; private final EnumFacing.Axis axis; private final EnumFacing field_150866_c; private final EnumFacing field_150863_d; private int field_150864_e = 0; private BlockPos field_150861_f; private int field_150862_g; private int field_150868_h; public Size(World worldIn, BlockPos pos, EnumFacing.Axis axis) { this.world = worldIn; this.axis = axis; if (axis == EnumFacing.Axis.X) { this.field_150863_d = EnumFacing.EAST; this.field_150866_c = EnumFacing.WEST; } else { this.field_150863_d = EnumFacing.NORTH; this.field_150866_c = EnumFacing.SOUTH; } for (BlockPos blockpos = pos; pos.getY() > blockpos.getY() - 21 && pos.getY() > 0 && this.func_150857_a(worldIn.getBlockState(pos.down()).getBlock()); pos = pos.down()) { ; } int i = this.func_180120_a(pos, this.field_150863_d) - 1; if (i >= 0) { this.field_150861_f = pos.offset(this.field_150863_d, i); this.field_150868_h = this.func_180120_a(this.field_150861_f, this.field_150866_c); if (this.field_150868_h < 2 || this.field_150868_h > 21) { this.field_150861_f = null; this.field_150868_h = 0; } } if (this.field_150861_f != null) { this.field_150862_g = this.func_150858_a(); } } protected int func_180120_a(BlockPos p_180120_1_, EnumFacing p_180120_2_) { int i; for (i = 0; i < 22; ++i) { BlockPos blockpos = p_180120_1_.offset(p_180120_2_, i); if (!this.func_150857_a(this.world.getBlockState(blockpos).getBlock()) || this.world.getBlockState(blockpos.down()).getBlock() != BedrockiumBlocks.slimyBedrockium) { break; } } Block block = this.world.getBlockState(p_180120_1_.offset(p_180120_2_, i)).getBlock(); return block == BedrockiumBlocks.slimyBedrockium ? i : 0; } public int func_181100_a() { return this.field_150862_g; } public int func_181101_b() { return this.field_150868_h; } protected int func_150858_a() { label24: for (this.field_150862_g = 0; this.field_150862_g < 21; ++this.field_150862_g) { for (int i = 0; i < this.field_150868_h; ++i) { BlockPos blockpos = this.field_150861_f.offset(this.field_150866_c, i).up(this.field_150862_g); Block block = this.world.getBlockState(blockpos).getBlock(); if (!this.func_150857_a(block)) { break label24; } if (block == BedrockiumBlocks.bedrockiumPortal) { ++this.field_150864_e; } if (i == 0) { block = this.world.getBlockState(blockpos.offset(this.field_150863_d)).getBlock(); if (block != BedrockiumBlocks.slimyBedrockium) { break label24; } } else if (i == this.field_150868_h - 1) { block = this.world.getBlockState(blockpos.offset(this.field_150866_c)).getBlock(); if (block != BedrockiumBlocks.slimyBedrockium) { break label24; } } } } for (int j = 0; j < this.field_150868_h; ++j) { if (this.world.getBlockState(this.field_150861_f.offset(this.field_150866_c, j).up(this.field_150862_g)).getBlock() != BedrockiumBlocks.slimyBedrockium) { this.field_150862_g = 0; break; } } if (this.field_150862_g <= 21 && this.field_150862_g >= 3) { return this.field_150862_g; } else { this.field_150861_f = null; this.field_150868_h = 0; this.field_150862_g = 0; return 0; } } protected boolean func_150857_a(Block block) { return block.getMaterial() == Material.air || block == Blocks.fire || block == BedrockiumBlocks.bedrockiumPortal; } public boolean func_150860_b() { return this.field_150861_f != null && this.field_150868_h >= 2 && this.field_150868_h <= 21 && this.field_150862_g >= 3 && this.field_150862_g <= 21; } public void func_150859_c() { for (int i = 0; i < this.field_150868_h; ++i) { BlockPos blockpos = this.field_150861_f.offset(this.field_150866_c, i); for (int j = 0; j < this.field_150862_g; ++j) { this.world.setBlockState(blockpos.up(j), BedrockiumBlocks.bedrockiumPortal.getDefaultState().withProperty(BedrockiumPortal.AXIS, this.axis), 2); } } } } } Also, the portal doesn't get created when lit with flint and steel... Any help would be very much apprechiated
-
I have added cobblestone for the granite, andesite and diorite variants. Now I want to be able to make them get dropped by their corresponding blocks. How (and where) can I overwrite the BlockStone's getItemDropped method?
-
[1.8.9] Rendering Custom Primed TNT (And custom Arrow)
Tschipp replied to Tschipp's topic in Modder Support
Bump -
[1.8.9] Rendering Custom Primed TNT (And custom Arrow)
Tschipp replied to Tschipp's topic in Modder Support
You were right! I goofed, I thought it was the range that the mob could track you from, and since a Arrow or Tnt shouldn't be able to track you I set it to 0. Well, it almost works now. The arrow gets rendered, but a second after it gets stuck in a block, it glitches out and gets teleported to a place where it was short before. This bug can also occur with normal arrows, but the effect ist way more extreme here. The Tnt also just gets rendered for a split second, then dissapears. Before getting teleported back: After getting teleported: EDIT: Fixed the Arrow, still stuck on the Tnt though -
[1.8.9] Rendering Custom Primed TNT (And custom Arrow)
Tschipp replied to Tschipp's topic in Modder Support
I mean, it works for the Golem. Here ist the Main Class: package tschipp.bedrockium; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventHandler; import net.minecraftforge.fml.common.Mod.Instance; import net.minecraftforge.fml.common.SidedProxy; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.registry.EntityRegistry; import tschipp.bedrockium.crafting.BedrockiumCrafting; import tschipp.bedrockium.entity.EntityBedrockiumArrow; import tschipp.bedrockium.entity.EntityBedrockiumBiter; import tschipp.bedrockium.entity.EntityBedrockiumGolem; import tschipp.bedrockium.entity.EntityBedrockiumTNTPrimed; import tschipp.bedrockium.items.BedrockiumItems; import tschipp.bedrockium.proxies.CommonProxy; @Mod(modid = "be", name = "Bedrockium Mod", version = "1.0") public class BedrockiumMod { @Instance(value = "bedrockium") public static BedrockiumMod instance; public static final String CLIENT_PROXY = "tschipp.bedrockium.proxies.ClientProxy"; public static final String COMMON_PROXY = "tschipp.bedrockium.proxies.CommonProxy"; @SidedProxy(clientSide = CLIENT_PROXY, serverSide = COMMON_PROXY) public static CommonProxy proxy; @EventHandler public void preInit(FMLPreInitializationEvent event) { //Item/Block init and registering //Config handling /* ConfigHandler.config = new Configuration(event.getSuggestedConfigurationFile()); ConfigHandler.syncConfig(); */ proxy.preInit(event); EntityRegistry.registerModEntity(EntityBedrockiumGolem.class, "BedrockiumGolem", 1, this, 60, 1, true); EntityRegistry.registerModEntity(EntityBedrockiumTNTPrimed.class, "BedrockiumTNT", 2, this, 0, 1, true); EntityRegistry.registerModEntity(EntityBedrockiumArrow.class, "BedrockiumArrow", 3, this, 0, 1, true); EntityRegistry.registerModEntity(EntityBedrockiumBiter.class, "BedrockiumBiter", 4, this, 60, 1, true, 27421, 3881787); } @EventHandler public void init(FMLInitializationEvent event) { //Proxy, TileEntity, entity, GUI and Packet Registering //All the Crafting Recipes proxy.init(event); BedrockiumCrafting.craft(); } @EventHandler public void postInit(FMLPostInitializationEvent event) { proxy.postInit(event); } public static CreativeTabs bedrockium = new CreativeTabs("bedrockium"){ @Override public Item getTabIconItem(){ return new ItemStack(BedrockiumItems.bedrockiumIngot).getItem(); } }; } -
[1.8.9] Rendering Custom Primed TNT (And custom Arrow)
Tschipp replied to Tschipp's topic in Modder Support
Like this? Still doesn't work. ClientProxy: package tschipp.bedrockium.proxies; import net.minecraft.client.Minecraft; import net.minecraftforge.fml.client.registry.RenderingRegistry; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import tschipp.bedrockium.blocks.BedrockiumBlockRendering; import tschipp.bedrockium.entity.EntityBedrockiumArrow; import tschipp.bedrockium.entity.EntityBedrockiumBiter; import tschipp.bedrockium.entity.EntityBedrockiumGolem; import tschipp.bedrockium.entity.EntityBedrockiumTNTPrimed; import tschipp.bedrockium.entity.render.RenderBedrockiumArrow; import tschipp.bedrockium.entity.render.RenderBedrockiumBiter; import tschipp.bedrockium.entity.render.RenderBedrockiumGolem; import tschipp.bedrockium.entity.render.RenderBedrockiumTNTPrimed; import tschipp.bedrockium.items.BedrockiumItemRendering; public class ClientProxy extends CommonProxy{ public void preInit(FMLPreInitializationEvent event) { super.preInit(event); RenderingRegistry.registerEntityRenderingHandler(EntityBedrockiumGolem.class, new RenderBedrockiumGolem.Factory()); RenderingRegistry.registerEntityRenderingHandler(EntityBedrockiumArrow.class, new RenderBedrockiumArrow.Factory()); } public void init(FMLInitializationEvent event) { super.init(event); BedrockiumItemRendering.registerItems(); BedrockiumBlockRendering.registerBlocks(); } public void postInit(FMLPostInitializationEvent event) { super.postInit(event); } } RenderBedrockiumTNT: package tschipp.bedrockium.entity.render; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.BlockRendererDispatcher; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.entity.Render; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.util.MathHelper; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.client.registry.IRenderFactory; import tschipp.bedrockium.blocks.BedrockiumBlocks; import tschipp.bedrockium.entity.EntityBedrockiumTNTPrimed; public class RenderBedrockiumTNTPrimed extends Render<EntityBedrockiumTNTPrimed> { public static final Factory FACTORY = new Factory(); public RenderBedrockiumTNTPrimed(RenderManager renderManager) { super(renderManager); this.shadowSize = 0.5F; } @Override public void doRender(EntityBedrockiumTNTPrimed entity, double x, double y, double z, float entityYaw, float partialTicks) { BlockRendererDispatcher blockrendererdispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher(); GlStateManager.pushMatrix(); GlStateManager.translate((float)x, (float)y + 0.5F, (float)z); if ((float)entity.fuse - partialTicks + 1.0F < 10.0F) { float f = 1.0F - ((float)entity.fuse - partialTicks + 1.0F) / 10.0F; f = MathHelper.clamp_float(f, 0.0F, 1.0F); f = f * f; f = f * f; float f1 = 1.0F + f * 0.3F; GlStateManager.scale(f1, f1, f1); } float f2 = (1.0F - ((float)entity.fuse - partialTicks + 1.0F) / 100.0F) * 0.8F; this.bindEntityTexture(entity); GlStateManager.translate(-0.5F, -0.5F, 0.5F); blockrendererdispatcher.renderBlockBrightness(BedrockiumBlocks.bedrockiumTnt.getDefaultState(), entity.getBrightness(partialTicks)); GlStateManager.translate(0.0F, 0.0F, 1.0F); if (entity.fuse / 5 % 2 == 0) { GlStateManager.disableTexture2D(); GlStateManager.disableLighting(); GlStateManager.enableBlend(); GlStateManager.blendFunc(770, 772); GlStateManager.color(1.0F, 1.0F, 1.0F, f2); GlStateManager.doPolygonOffset(-3.0F, -3.0F); GlStateManager.enablePolygonOffset(); blockrendererdispatcher.renderBlockBrightness(BedrockiumBlocks.bedrockiumTnt.getDefaultState(), 1.0F); GlStateManager.doPolygonOffset(0.0F, 0.0F); GlStateManager.disablePolygonOffset(); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.disableBlend(); GlStateManager.enableLighting(); GlStateManager.enableTexture2D(); } GlStateManager.popMatrix(); super.doRender(entity, x, y, z, entityYaw, partialTicks); } /** * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. */ @Override protected ResourceLocation getEntityTexture(EntityBedrockiumTNTPrimed entity) { return TextureMap.locationBlocksTexture; } public static class Factory implements IRenderFactory<EntityBedrockiumTNTPrimed> { @Override public Render<? super EntityBedrockiumTNTPrimed> createRenderFor(RenderManager manager) { return new RenderBedrockiumTNTPrimed(manager); } } } RenderBedrockiumArrow: package tschipp.bedrockium.entity.render; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.client.renderer.entity.Render; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.util.MathHelper; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.client.registry.IRenderFactory; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import org.lwjgl.opengl.GL11; import tschipp.bedrockium.entity.EntityBedrockiumArrow; import tschipp.bedrockium.entity.EntityBedrockiumArrow; import tschipp.bedrockium.entity.models.ModelBedrockiumGolem; import tschipp.bedrockium.entity.render.RenderBedrockiumGolem.Factory; @SideOnly(Side.CLIENT) public class RenderBedrockiumArrow extends Render<EntityBedrockiumArrow> { public static final Factory FACTORY = new Factory(); private static final ResourceLocation arrowTextures = new ResourceLocation("be:textures/entity/arrow.png"); public RenderBedrockiumArrow(RenderManager renderManager) { super(renderManager); } /** * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic * (Render<T extends Entity>) and this method has signature public void func_76986_a(T entity, double d, double d1, * double d2, float f, float f1). But JAD is pre 1.5 so doe */ public void doRender(EntityBedrockiumArrow entity, double x, double y, double z, float entityYaw, float partialTicks) { this.bindEntityTexture(entity); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.pushMatrix(); GlStateManager.translate((float)x, (float)y, (float)z); GlStateManager.rotate(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * partialTicks - 90.0F, 0.0F, 1.0F, 0.0F); GlStateManager.rotate(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * partialTicks, 0.0F, 0.0F, 1.0F); Tessellator tessellator = Tessellator.getInstance(); WorldRenderer worldrenderer = tessellator.getWorldRenderer(); int i = 0; float f = 0.0F; float f1 = 0.5F; float f2 = (float)(0 + i * 10) / 32.0F; float f3 = (float)(5 + i * 10) / 32.0F; float f4 = 0.0F; float f5 = 0.15625F; float f6 = (float)(5 + i * 10) / 32.0F; float f7 = (float)(10 + i * 10) / 32.0F; float f8 = 0.05625F; GlStateManager.enableRescaleNormal(); float f9 = (float)entity.arrowShake - partialTicks; if (f9 > 0.0F) { float f10 = -MathHelper.sin(f9 * 3.0F) * f9; GlStateManager.rotate(f10, 0.0F, 0.0F, 1.0F); } GlStateManager.rotate(45.0F, 1.0F, 0.0F, 0.0F); GlStateManager.scale(f8, f8, f8); GlStateManager.translate(-4.0F, 0.0F, 0.0F); GL11.glNormal3f(f8, 0.0F, 0.0F); worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX); worldrenderer.pos(-7.0D, -2.0D, -2.0D).tex((double)f4, (double)f6).endVertex(); worldrenderer.pos(-7.0D, -2.0D, 2.0D).tex((double)f5, (double)f6).endVertex(); worldrenderer.pos(-7.0D, 2.0D, 2.0D).tex((double)f5, (double)f7).endVertex(); worldrenderer.pos(-7.0D, 2.0D, -2.0D).tex((double)f4, (double)f7).endVertex(); tessellator.draw(); GL11.glNormal3f(-f8, 0.0F, 0.0F); worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX); worldrenderer.pos(-7.0D, 2.0D, -2.0D).tex((double)f4, (double)f6).endVertex(); worldrenderer.pos(-7.0D, 2.0D, 2.0D).tex((double)f5, (double)f6).endVertex(); worldrenderer.pos(-7.0D, -2.0D, 2.0D).tex((double)f5, (double)f7).endVertex(); worldrenderer.pos(-7.0D, -2.0D, -2.0D).tex((double)f4, (double)f7).endVertex(); tessellator.draw(); for (int j = 0; j < 4; ++j) { GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F); GL11.glNormal3f(0.0F, 0.0F, f8); worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX); worldrenderer.pos(-8.0D, -2.0D, 0.0D).tex((double)f, (double)f2).endVertex(); worldrenderer.pos(8.0D, -2.0D, 0.0D).tex((double)f1, (double)f2).endVertex(); worldrenderer.pos(8.0D, 2.0D, 0.0D).tex((double)f1, (double)f3).endVertex(); worldrenderer.pos(-8.0D, 2.0D, 0.0D).tex((double)f, (double)f3).endVertex(); tessellator.draw(); } GlStateManager.disableRescaleNormal(); GlStateManager.popMatrix(); super.doRender(entity, x, y, z, entityYaw, partialTicks); } /** * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. */ protected ResourceLocation getEntityTexture(EntityBedrockiumArrow entity) { return arrowTextures; } public static class Factory implements IRenderFactory<EntityBedrockiumArrow> { @Override public Render<? super EntityBedrockiumArrow> createRenderFor(RenderManager manager) { return new RenderBedrockiumArrow(manager); } } } -
I'm having trouble with rendering my PrimedTnt. I basically copied and edited the vanilla PrimedTnt class, but when I spawn the Entity, it's invisible (It still explodes though.) Here is my Render Class: package tschipp.bedrockium.entity.render; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.BlockRendererDispatcher; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.entity.Render; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.util.MathHelper; import net.minecraft.util.ResourceLocation; import tschipp.bedrockium.blocks.BedrockiumBlocks; import tschipp.bedrockium.entity.EntityBedrockiumTNTPrimed; import tschipp.bedrockium.entity.render.RenderBedrockiumGolem.Factory; public class RenderBedrockiumTNTPrimed extends Render<EntityBedrockiumTNTPrimed> { public RenderBedrockiumTNTPrimed(RenderManager renderManager) { super(renderManager); this.shadowSize = 0.5F; } @Override public void doRender(EntityBedrockiumTNTPrimed entity, double x, double y, double z, float entityYaw, float partialTicks) { BlockRendererDispatcher blockrendererdispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher(); GlStateManager.pushMatrix(); GlStateManager.translate((float)x, (float)y + 0.5F, (float)z); if ((float)entity.fuse - partialTicks + 1.0F < 10.0F) { float f = 1.0F - ((float)entity.fuse - partialTicks + 1.0F) / 10.0F; f = MathHelper.clamp_float(f, 0.0F, 1.0F); f = f * f; f = f * f; float f1 = 1.0F + f * 0.3F; GlStateManager.scale(f1, f1, f1); } float f2 = (1.0F - ((float)entity.fuse - partialTicks + 1.0F) / 100.0F) * 0.8F; this.bindEntityTexture(entity); GlStateManager.translate(-0.5F, -0.5F, 0.5F); blockrendererdispatcher.renderBlockBrightness(BedrockiumBlocks.bedrockiumTnt.getDefaultState(), entity.getBrightness(partialTicks)); GlStateManager.translate(0.0F, 0.0F, 1.0F); if (entity.fuse / 5 % 2 == 0) { GlStateManager.disableTexture2D(); GlStateManager.disableLighting(); GlStateManager.enableBlend(); GlStateManager.blendFunc(770, 772); GlStateManager.color(1.0F, 1.0F, 1.0F, f2); GlStateManager.doPolygonOffset(-3.0F, -3.0F); GlStateManager.enablePolygonOffset(); blockrendererdispatcher.renderBlockBrightness(BedrockiumBlocks.bedrockiumTnt.getDefaultState(), 1.0F); GlStateManager.doPolygonOffset(0.0F, 0.0F); GlStateManager.disablePolygonOffset(); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.disableBlend(); GlStateManager.enableLighting(); GlStateManager.enableTexture2D(); } GlStateManager.popMatrix(); super.doRender(entity, x, y, z, entityYaw, partialTicks); } /** * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. */ @Override protected ResourceLocation getEntityTexture(EntityBedrockiumTNTPrimed entity) { return TextureMap.locationBlocksTexture; } } And my ClientProxy: package tschipp.bedrockium.proxies; import net.minecraft.client.Minecraft; import net.minecraftforge.fml.client.registry.RenderingRegistry; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import tschipp.bedrockium.blocks.BedrockiumBlockRendering; import tschipp.bedrockium.entity.EntityBedrockiumGolem; import tschipp.bedrockium.entity.EntityBedrockiumTNTPrimed; import tschipp.bedrockium.entity.render.RenderBedrockiumGolem; import tschipp.bedrockium.entity.render.RenderBedrockiumTNTPrimed; import tschipp.bedrockium.items.BedrockiumItemRendering; public class ClientProxy extends CommonProxy{ public void preInit(FMLPreInitializationEvent event) { super.preInit(event); RenderingRegistry.registerEntityRenderingHandler(EntityBedrockiumGolem.class, new RenderBedrockiumGolem.Factory()); //Different Things that i've tried, none of them work RenderingRegistry.registerEntityRenderingHandler(EntityBedrockiumTNTPrimed.class, new RenderBedrockiumTNTPrimed(Minecraft.getMinecraft().getRenderManager())); } public void init(FMLInitializationEvent event) { super.init(event); BedrockiumItemRendering.registerItems(); BedrockiumBlockRendering.registerBlocks(); //Different Things that i've tried, none of them work Minecraft.getMinecraft().getRenderManager().entityRenderMap.put(EntityBedrockiumTNTPrimed.class, new RenderBedrockiumTNTPrimed(Minecraft.getMinecraft().getRenderManager())); RenderingRegistry.registerEntityRenderingHandler(EntityBedrockiumTNTPrimed.class, new RenderBedrockiumTNTPrimed(Minecraft.getMinecraft().getRenderManager())); } public void postInit(FMLPostInitializationEvent event) { super.postInit(event); } } EDIT: I just did the same for a custom Arrow, it also doesn't get rendered in-game (Still works though). It appears that there seems to be a problem if the model is not in a separate model class. Here is the RenderArrow: package tschipp.bedrockium.entity.render; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.client.renderer.entity.Render; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.util.MathHelper; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.client.registry.IRenderFactory; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import org.lwjgl.opengl.GL11; import tschipp.bedrockium.entity.EntityBedrockiumArrow; import tschipp.bedrockium.entity.EntityBedrockiumArrow; import tschipp.bedrockium.entity.models.ModelBedrockiumGolem; import tschipp.bedrockium.entity.render.RenderBedrockiumGolem.Factory; @SideOnly(Side.CLIENT) public class RenderBedrockiumArrow extends Render<EntityBedrockiumArrow> { public static final Factory FACTORY = new Factory(); private static final ResourceLocation arrowTextures = new ResourceLocation("be:textures/entity/arrow.png"); public RenderBedrockiumArrow(RenderManager renderManager) { super(renderManager); } /** * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic * (Render<T extends Entity>) and this method has signature public void func_76986_a(T entity, double d, double d1, * double d2, float f, float f1). But JAD is pre 1.5 so doe */ public void doRender(EntityBedrockiumArrow entity, double x, double y, double z, float entityYaw, float partialTicks) { this.bindEntityTexture(entity); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.pushMatrix(); GlStateManager.translate((float)x, (float)y, (float)z); GlStateManager.rotate(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * partialTicks - 90.0F, 0.0F, 1.0F, 0.0F); GlStateManager.rotate(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * partialTicks, 0.0F, 0.0F, 1.0F); Tessellator tessellator = Tessellator.getInstance(); WorldRenderer worldrenderer = tessellator.getWorldRenderer(); int i = 0; float f = 0.0F; float f1 = 0.5F; float f2 = (float)(0 + i * 10) / 32.0F; float f3 = (float)(5 + i * 10) / 32.0F; float f4 = 0.0F; float f5 = 0.15625F; float f6 = (float)(5 + i * 10) / 32.0F; float f7 = (float)(10 + i * 10) / 32.0F; float f8 = 0.05625F; GlStateManager.enableRescaleNormal(); float f9 = (float)entity.arrowShake - partialTicks; if (f9 > 0.0F) { float f10 = -MathHelper.sin(f9 * 3.0F) * f9; GlStateManager.rotate(f10, 0.0F, 0.0F, 1.0F); } GlStateManager.rotate(45.0F, 1.0F, 0.0F, 0.0F); GlStateManager.scale(f8, f8, f8); GlStateManager.translate(-4.0F, 0.0F, 0.0F); GL11.glNormal3f(f8, 0.0F, 0.0F); worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX); worldrenderer.pos(-7.0D, -2.0D, -2.0D).tex((double)f4, (double)f6).endVertex(); worldrenderer.pos(-7.0D, -2.0D, 2.0D).tex((double)f5, (double)f6).endVertex(); worldrenderer.pos(-7.0D, 2.0D, 2.0D).tex((double)f5, (double)f7).endVertex(); worldrenderer.pos(-7.0D, 2.0D, -2.0D).tex((double)f4, (double)f7).endVertex(); tessellator.draw(); GL11.glNormal3f(-f8, 0.0F, 0.0F); worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX); worldrenderer.pos(-7.0D, 2.0D, -2.0D).tex((double)f4, (double)f6).endVertex(); worldrenderer.pos(-7.0D, 2.0D, 2.0D).tex((double)f5, (double)f6).endVertex(); worldrenderer.pos(-7.0D, -2.0D, 2.0D).tex((double)f5, (double)f7).endVertex(); worldrenderer.pos(-7.0D, -2.0D, -2.0D).tex((double)f4, (double)f7).endVertex(); tessellator.draw(); for (int j = 0; j < 4; ++j) { GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F); GL11.glNormal3f(0.0F, 0.0F, f8); worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX); worldrenderer.pos(-8.0D, -2.0D, 0.0D).tex((double)f, (double)f2).endVertex(); worldrenderer.pos(8.0D, -2.0D, 0.0D).tex((double)f1, (double)f2).endVertex(); worldrenderer.pos(8.0D, 2.0D, 0.0D).tex((double)f1, (double)f3).endVertex(); worldrenderer.pos(-8.0D, 2.0D, 0.0D).tex((double)f, (double)f3).endVertex(); tessellator.draw(); } GlStateManager.disableRescaleNormal(); GlStateManager.popMatrix(); super.doRender(entity, x, y, z, entityYaw, partialTicks); } /** * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. */ protected ResourceLocation getEntityTexture(EntityBedrockiumArrow entity) { return arrowTextures; } public static class Factory implements IRenderFactory<EntityBedrockiumArrow> { @Override public Render<? super EntityBedrockiumArrow> createRenderFor(RenderManager manager) { return new RenderBedrockiumArrow(manager); } } }
-
They store the values for BlockPos so that they can get placed by the Item.
-
They are fields in my Item class... So how should I do it differently? Forge Events? Packets?
-
Hi I have this tool that when I right click, it fills a flat area with Blocks. The problem is, the blocks sometimes get placed on the server and client side correctly, but when the amount of blocks that are changing is too large, they only get placed on the client side. Here's my code: @Override public EnumActionResult onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { matToReplace = world.getBlockState(pos); positions.add(pos); for(int i = 0; i < 80; i++) { for(int j = 0; j < positions.size(); j++) { if(side == EnumFacing.NORTH || side == EnumFacing.SOUTH) { addPositionsNorth(j,world); } if(side == EnumFacing.EAST || side == EnumFacing.WEST) { addPositionsEast(j,world); } if(side == EnumFacing.DOWN || side == EnumFacing.UP) { addPositionsDown(j,world); } } positions.addAll(tempPositions); tempPositions.clear(); } for(int k = 0; k < positions.size(); k++) { world.setBlockState(positions.get(k), Block.getBlockFromName(stack.getTagCompound().getString("material")).getStateFromMeta(stack.getTagCompound().getInteger("damage"))); world.scheduleBlockUpdate(positions.get(k), world.getBlockState(positions.get(k)).getBlock(), 1, 1); } positions.clear(); tempPositions.clear(); return EnumActionResult.PASS; } Any help would be apprechiated
-
Bump because I still haven't fixed it
-
public boolean onBlockStartBreak(ItemStack itemstack, BlockPos pos, EntityPlayer player) { World world = player.worldObj; if(player.isSneaking()) { mat = world.getBlockState(pos); NBTTagCompound tag = itemstack.getTagCompound(); tag.setString("material", mat.getBlock().getRegistryName().getResourceDomain() + ":" + mat.getBlock().getRegistryName().getResourcePath()); tag.setInteger("damage", mat.getBlock().getMetaFromState(mat)); itemstack.setTagCompound(tag); Block block = (Block)Block.REGISTRY.getObject(new ResourceLocation(itemstack.getTagCompound().getString("material"))); if(!world.isRemote) { player.addChatComponentMessage(new TextComponentString(TextFormatting.LIGHT_PURPLE +"Material set to: " + net.minecraft.util.text.translation.I18n.translateToLocal(net.minecraft.util.text.translation.I18n.translateToLocal(block.getLocalizedName())))); } world.notifyNeighborsOfStateChange(pos, mat.getBlock()); } return true; }
-
Hi, I'm using the method "onBlockStartBreak", which gets executed every time a block is broken. I return true, which makes it so that the block doesn't get broken and doesn't drop an Item. However, the block turns invisible until I restart the world. I've tried forcing a block update using world.scheduleBlockUpdate and world.notifyNeighborsRespectDebug, none of which seemed to work. What can I do?
-
So I tried around a bit more and I think that I have narrowed down the problem. This is my code right now: package tschipp.bedrockium.blocks; import net.minecraft.block.BlockLog; import net.minecraft.block.BlockNewLog; import net.minecraft.block.BlockPlanks; import net.minecraft.block.BlockRotatedPillar; import net.minecraft.block.material.MapColor; import net.minecraft.block.material.Material; import net.minecraft.block.properties.PropertyEnum; import net.minecraft.util.EnumFacing; public class BlastLog extends BlockRotatedPillar{ public static final PropertyEnum<BlockLog.EnumAxis> LOG_AXIS = PropertyEnum.<BlockLog.EnumAxis>create("axis", BlockLog.EnumAxis.class); protected BlastLog(Material material, MapColor color) { super(material, color); this.setResistance(5000F); this.setHardness(7.5F); this.setHarvestLevel("axe", 3); this.setStepSound(soundTypeWood); this.setUnlocalizedName("blastLog"); this.setDefaultState(this.blockState.getBaseState().withProperty(LOG_AXIS, BlockLog.EnumAxis.Y)); } } It crashes me with this error report: [20:35:05] [Client thread/INFO] [sTDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:612]: ---- Minecraft Crash Report ---- // You should try our sister game, Minceraft! Time: 27.10.16 20:35 Description: Initializing game java.lang.IllegalArgumentException: Cannot set property PropertyEnum{name=axis, clazz=class net.minecraft.block.BlockLog$EnumAxis, values=[x, y, z, none]} as it does not exist in BlockState{block=null, properties=[]} at net.minecraft.block.state.BlockState$StateImplementation.withProperty(BlockState.java:156) at tschipp.bedrockium.blocks.BlastLog.<init>(BlastLog.java:24) at tschipp.bedrockium.blocks.BedrockiumBlocks.createBlocks(BedrockiumBlocks.java:41) at tschipp.bedrockium.proxies.CommonProxy.preInit(CommonProxy.java:14) at tschipp.bedrockium.proxies.ClientProxy.preInit(ClientProxy.java:14) at tschipp.bedrockium.BedrockiumMod.preInit(BedrockiumMod.java:44) 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:497) at net.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:560) 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:497) at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) at com.google.common.eventbus.EventBus.post(EventBus.java:275) at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:211) at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:189) 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:497) at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) at com.google.common.eventbus.EventBus.post(EventBus.java:275) at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:118) at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:556) at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:243) at net.minecraft.client.Minecraft.startGame(Minecraft.java:451) at net.minecraft.client.Minecraft.run(Minecraft.java:360) at net.minecraft.client.main.Main.main(Main.java:116) 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:497) 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:497) 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 -- Stacktrace: at net.minecraft.block.state.BlockState$StateImplementation.withProperty(BlockState.java:156) at tschipp.bedrockium.blocks.BlastLog.<init>(BlastLog.java:24) at tschipp.bedrockium.blocks.BedrockiumBlocks.createBlocks(BedrockiumBlocks.java:41) at tschipp.bedrockium.proxies.CommonProxy.preInit(CommonProxy.java:14) at tschipp.bedrockium.proxies.ClientProxy.preInit(ClientProxy.java:14) at tschipp.bedrockium.BedrockiumMod.preInit(BedrockiumMod.java:44) 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:497) at net.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:560) 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:497) at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) at com.google.common.eventbus.EventBus.post(EventBus.java:275) at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:211) at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:189) 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:497) at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) at com.google.common.eventbus.EventBus.post(EventBus.java:275) at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:118) at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:556) at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:243) at net.minecraft.client.Minecraft.startGame(Minecraft.java:451)
-
I'm trying to create a custom Log Block, by extending BlockRotatedPillar. I have all the model and texture files arranged correctly. My problem is, that the log doesn't get rotated when I place it. In fact, it doesn't even seem to have a property at all. I'm probably just overlooking something, this is my first time working with blockstates... Here is my code: package tschipp.bedrockium.blocks; import net.minecraft.block.BlockLog; import net.minecraft.block.BlockRotatedPillar; import net.minecraft.block.material.MapColor; import net.minecraft.block.material.Material; import net.minecraft.block.properties.PropertyEnum; import net.minecraft.util.EnumFacing; public class BlastLog extends BlockRotatedPillar{ protected BlastLog(Material material, MapColor color) { super(material, color); this.setResistance(5000F); this.setHardness(7.5F); this.setHarvestLevel("axe", 3); this.setStepSound(soundTypeWood); this.setUnlocalizedName("blastLog"); } }
-
Thanks for sticking around and helping me
-
Umm no I want to cancel the event, so that the scrolling doesn't switch to another Item, and I only want to do that if the player is sneaking EDIT: Nevermind me, I just noticed that getItemInUse is the wrong function to use EDIT2: It all works!