Everything posted by herbix
-
[1.8][SOLVED] Has Anyone fixed their portals for their custom dimensions?
Set and check player.timeUntilPortal. if(player.timeUntilPortal > 0){ player.timeUntilPortal = 10; }else if(player.dimension != ZeroQuest.NillaxID){ player.timeUntilPortal = 10; player.mcServer.getConfigurationManager().transferPlayerToDimension(player, ZeroQuest.NillaxID, new TeleporterNillax(server.worldServerForDimension(ZeroQuest.NillaxID), false)); }else{ player.timeUntilPortal = 10; player.mcServer.getConfigurationManager().transferPlayerToDimension(player, 0, new TeleporterNillax(server.worldServerForDimension(0), false)); }
-
[1.8][SOLVED] Has Anyone fixed their portals for their custom dimensions?
As it shows, it's my dimension id. You could replace it with yours.
-
[1.8][SOLVED] Has Anyone fixed their portals for their custom dimensions?
No need to use transferEntityToWorld. Simply kill the old entity and spawn a new entity in target world. Just like my codes above does.
-
[1.8] Multi-Layer Block Texture
No need to use ISmartBlockModel, IModel is enough. Following steps may help you: [*]IModel.getTextures should return your stone texture and user defined ore overlay [*]IModel.getDependencies should return your stone model because we would use it [*]IModel.bake would return the model: Use ModelLoaderRegistry.getModel to get your stone model Create a SimpleBakedModel, using the property from your stone model Add overlay to this SimpleBakedModel, to do this, you need to know about BakedQuad and SimpleBakedModel But users have to provide a blockstate json file after all... I don't know much about how to map a blockstate file in codes.
-
[1.8] Multi-Layer Block Texture
I don't know either. It depends on your api definations. Do api users provide a json model, or just an overlay texture?
-
[1.8][SOLVED] Has Anyone fixed their portals for their custom dimensions?
These fire models is in 1.8.3.jar with other block models. Recheck it and you would find them. (There are so many!)
-
[1.8] Multi-Layer Block Texture
Oh, I see. You do need customize a block renderer. Maybe this tutorial could help: http://www.minecraftforge.net/forum/index.php/topic,28714.0.html Load a stone model and clone it first, then add ore quads, finally return it.
-
[1.8][SOLVED] Has Anyone fixed their portals for their custom dimensions?
At least local variables should have a good name I thought.
-
[1.8][SOLVED] Has Anyone fixed their portals for their custom dimensions?
In my opinion, it's a better choice to rewrite func_176548_d than trying to fix it. Obfuscated codes make it harder to read or modify. It would also make trouble in future updates.
-
[1.8] Multi-Layer Block Texture
No need to create a custom block renderer. By simply modifying the json model file you could get a multi-layer block. Just put two elements at same position but attach different textures.
-
[1.8][SOLVED] Has Anyone fixed their portals for their custom dimensions?
Please show me the codes that activate your portal.
-
[1.8][SOLVED] Has Anyone fixed their portals for their custom dimensions?
About why you teleports you to nether: you should override onEntityCollidedWithBlock(World, BlockPos, IBlockState, Entity) not onEntityCollidedWithBlock(World, BlockPos, Entity). I would say WTF when two methods share same name and similar parameters but are totally different!
-
[1.8][SOLVED] Has Anyone fixed their portals for their custom dimensions?
And.. what's the problem? Players simply cannot be teleported?
-
[1.8][SOLVED] Has Anyone fixed their portals for their custom dimensions?
Could you show me your BlockPortal? I didn't find it in your respository.
-
[1.8][SOLVED] Has Anyone fixed their portals for their custom dimensions?
Actually I didn't change much with my portal, except simply move x,y,z to BlockPos. Here's my BlockPortal, which is slightly changed since 1.7.2: // package and imports ... public class BlockTaoPortal extends BlockBreakable { public static final PropertyDirection FACING = PropertyDirection.create("facing", EnumFacing.Plane.HORIZONTAL); public BlockTaoPortal() { super(Material.portal, false); MinecraftForge.EVENT_BUS.register(new EventHandler()); TaoLandMod.runner.registerLoopTask(new CheckYinyangBallTask()); } @Override public AxisAlignedBB getCollisionBoundingBox(World world, BlockPos pos, IBlockState state) { return null; } @Override public boolean isFullCube() { return false; } @Override public int quantityDropped(Random rand) { return 0; } @Override @SideOnly(Side.CLIENT) public final Item getItem(World world, BlockPos pos) { return null; } @Override @SideOnly(Side.CLIENT) public EnumWorldBlockLayer getBlockLayer() { return EnumWorldBlockLayer.TRANSLUCENT; } @Override public void setBlockBoundsBasedOnState(IBlockAccess world, BlockPos pos) { IBlockState state = world.getBlockState(pos); EnumFacing facing = (EnumFacing)state.getValue(FACING); if(facing == EnumFacing.EAST || facing == EnumFacing.WEST) { this.setBlockBounds(0.4f, 0, 0, 0.6f, 1, 1); } else { this.setBlockBounds(0, 0, 0.4f, 1, 1, 0.6f); } } @Override public void onNeighborBlockChange(World world, BlockPos pos, IBlockState state, Block block) { EnumFacing facing = (EnumFacing)state.getValue(FACING); boolean shouldBreak = false; shouldBreak |= (!blockIsPortalOrSolid(world.getBlockState(pos.down()).getBlock()) || !blockIsPortalOrSolid(world.getBlockState(pos.up()).getBlock())); if(facing == EnumFacing.EAST || facing == EnumFacing.WEST) { shouldBreak |= (!blockIsPortalOrSolid(world.getBlockState(pos.north()).getBlock()) || !blockIsPortalOrSolid(world.getBlockState(pos.south()).getBlock())); } else { shouldBreak |= (!blockIsPortalOrSolid(world.getBlockState(pos.east()).getBlock()) || !blockIsPortalOrSolid(world.getBlockState(pos.west()).getBlock())); } if(shouldBreak) { world.setBlockState(pos, Blocks.air.getDefaultState()); } } public boolean blockIsPortalOrSolid(Block block) { return block.isOpaqueCube() || block == this; } @Override public void onEntityCollidedWithBlock(World world, BlockPos pos, IBlockState state, Entity entity) { if(entity.ridingEntity == null && entity.riddenByEntity == null && entity.timeUntilPortal <= 0) { int id = TaoLandModConfig.instance().dimensionId; if(entity.dimension == id) { id = 0; } if(entity instanceof EntityPlayerMP) { EntityPlayerMP player = (EntityPlayerMP)entity; MinecraftServer mcServer = player.mcServer; if(id == 0) { Teleporter teleporter = new TaoTeleporter(mcServer.worldServerForDimension(id)); mcServer.getConfigurationManager().transferPlayerToDimension(player, id, teleporter); } else { player.triggerAchievement(TaoLandAchievement.tao); Teleporter teleporter = new TaoTeleporter(mcServer.worldServerForDimension(id)); mcServer.getConfigurationManager().transferPlayerToDimension(player, id, teleporter); player.triggerAchievement(TaoLandAchievement.taoWorld); } } else { travelToDimension(entity, id); } } } private void travelToDimension(Entity entity, int id) { if (!entity.worldObj.isRemote && !entity.isDead) { entity.worldObj.theProfiler.startSection("changeDimension"); MinecraftServer minecraftserver = MinecraftServer.getServer(); int j = entity.dimension; WorldServer worldserver = minecraftserver.worldServerForDimension(j); WorldServer worldserver1 = minecraftserver.worldServerForDimension(id); entity.dimension = id; if (j == 1 && id == 1) { worldserver1 = minecraftserver.worldServerForDimension(0); entity.dimension = 0; } entity.worldObj.removeEntity(entity); entity.isDead = false; entity.worldObj.theProfiler.startSection("reposition"); minecraftserver.getConfigurationManager().transferEntityToWorld(entity, j, worldserver, worldserver1, new TaoTeleporter(worldserver1)); entity.worldObj.theProfiler.endStartSection("reloading"); Entity entity1 = EntityList.createEntityByName(EntityList.getEntityString(entity), worldserver1); if (entity1 != null) { entity1.copyDataFromOld(entity); if (j == 1 && id == 1) { BlockPos spawnPoint = worldserver1.getSpawnPoint(); spawnPoint = entity.worldObj.getTopSolidOrLiquidBlock(spawnPoint); entity1.setLocationAndAngles(spawnPoint.getX(), spawnPoint.getY(), spawnPoint.getZ(), entity1.rotationYaw, entity1.rotationPitch); } worldserver1.spawnEntityInWorld(entity1); } entity.isDead = true; entity.worldObj.theProfiler.endSection(); worldserver.resetUpdateEntityTick(); worldserver1.resetUpdateEntityTick(); entity.worldObj.theProfiler.endSection(); } } @Override public IBlockState getStateFromMeta(int meta) { EnumFacing facing = EnumFacing.getFront(meta); return this.getDefaultState().withProperty(FACING, facing); } @Override public int getMetaFromState(IBlockState state) { return ((EnumFacing)state.getValue(FACING)).getIndex(); } @Override protected BlockState createBlockState() { return new BlockState(this, new IProperty[] { FACING }); } @SideOnly(Side.CLIENT) @Override public void randomDisplayTick(World world, BlockPos pos, IBlockState state, Random rand) { Axis axis = ((EnumFacing)state.getValue(FACING)).getAxis(); boolean cond = axis == Axis.Z; int i = rand.nextInt(2) * 2 - 1; TaoLandMod.proxy.spawnParticleInWorld(ParticleType.PORTAL, world, pos.getX() + rand.nextDouble(), pos.getY() + rand.nextDouble(), pos.getZ() + rand.nextDouble(), i * (cond ? 0 : 1), 0, i * (cond ? 1 : 0), world.provider.getDimensionId() != 0); } private List<EntityItem> yinyangBalls = new ArrayList<EntityItem>(); public class EventHandler { @SubscribeEvent public void onItemToss(ItemTossEvent event) { EntityItem ei = event.entityItem; if(ei.getEntityItem().getItem() == TaoLandItems.yinyangBall && (ei.dimension == 0 || ei.dimension == TaoLandModConfig.instance().dimensionId)) { yinyangBalls.add(ei); } } } class CheckYinyangBallTask implements Runnable { @Override public void run() { Iterator<EntityItem> it = yinyangBalls.iterator(); while(it.hasNext()) { EntityItem ei = it.next(); int x = MathHelper.floor_double(ei.posX); int y = MathHelper.floor_double(ei.posY); int z = MathHelper.floor_double(ei.posZ); if(ei.isBurning()) { ei.setDead(); ei.worldObj.createExplosion(ei, ei.posX, ei.posY, ei.posZ, 1, false); y--; int meta = ei.worldObj.rand.nextInt(4)+1; new TaoTeleporter((WorldServer) ei.worldObj).buildPortal(x-(meta==1?1:2), y, z-(meta==3?1:2), meta, false); } if(ei.isDead) { it.remove(); } } } } }
-
Here is a tool to render entity or block model in parallel projection.
Old Subject: Is there any tools to render entity or block model in parallel projection? Old Contect: Just like some pictures in official minecraft wiki. They are well-rendered and in high resolution: [/img] [/img] I have to do it by myself if none available.
-
Custom door: Model definition for... not found [SOLVED]
Have a look at your error: Model definition for location smith:doorCopper#facing=south,half=upper,hinge=left,open=false,powered=true not found But you didn't have a "power" property in your copper_door.json. You could add these code to your preInit to ignore "power" property when loading models: ModelLoader.setCustomStateMapper(yourDoorInstance, (new StateMap.Builder()).addPropertiesToIgnore(new IProperty[] {YourDoorClass.POWERED}).build()); ======== But the statements above won't cause crash. It just makes a lost model. Let's talk about the crash. It seems that you didn't set correct properties in Block.createBlockState method. Maybe I need your custom door block class to continue my diagnosis.
-
[1.8][1.7.10] Discuss about IntCache
The strangest thing is that I didn't feel a vanilla crash caused by getInts. It only happens to my mod. I'm sure it's a multithreading problem, but not sure why crash occurs only in my mod.
-
[1.8][1.7.10] Discuss about IntCache
Oops. I found out that vanilla EntityRenderer.addRainParticles uses World.getBiomeGenForCoords as well. But I still doubt whether this would cause crash. Edit: More and more CLIENT side uses found. That's not a mistake of ForgeHooksClient.getSkyBlendColour.
-
[1.8][1.7.10] Discuss about IntCache
IntCache is used in GenLayer and its subclasses to cache int arrays. It's reseted in the front of biome-related methods such as getBiomesForGeneration or getBiomeGenAt. Now here comes a problem: GenLayer.getInt is called in both CLIENT and SERVER sides. It's ok using a dedicated server. However, in intergrated server, CLIENT and SERVER sides are in two thread. So they may call a biome method at same time. That means, IntCache might be reseted in CLIENT thread while SERVER thread is using it! If unlucky, game crashes. I suffered from the crash for a long time but coundn't find the reason. I got it just now as I put a printing current thread statement in my GenLayer.getInts method. I found out that it was called in both CLIENT and SERVER threads. I realized what was responsible for these crashes. Now I put one crash report fragment here: ---- Minecraft Crash Report ---- // Oops. Time: 15-4-4 10:05 PM Description: Getting biome java.lang.ArrayIndexOutOfBoundsException: 114 at me.herbix.taoland.world.gen.layer.GenLayerByProperty.getInts(GenLayerByProperty.java:65) at me.herbix.taoland.world.gen.layer.GenLayerZoom.getInts(GenLayerZoom.java:25) at me.herbix.taoland.world.gen.layer.GenLayerZoom.getInts(GenLayerZoom.java:25) at me.herbix.taoland.world.gen.layer.GenLayerZoom.getInts(GenLayerZoom.java:25) at me.herbix.taoland.world.gen.layer.GenLayerZoom.getInts(GenLayerZoom.java:25) at net.minecraft.world.gen.layer.GenLayerSmooth.getInts(GenLayerSmooth.java:23) at me.herbix.taoland.world.gen.layer.GenLayerRiverMix.getInts(GenLayerRiverMix.java:18) at net.minecraft.world.gen.layer.GenLayerVoronoiZoom.getInts(GenLayerVoronoiZoom.java:25) at net.minecraft.world.biome.WorldChunkManager.getBiomeGenAt(WorldChunkManager.java:199) at net.minecraft.world.biome.BiomeCache$Block.<init>(BiomeCache.java:106) at net.minecraft.world.biome.BiomeCache.getBiomeCacheBlock(BiomeCache.java:37) at net.minecraft.world.biome.BiomeCache.func_180284_a(BiomeCache.java:48) at net.minecraft.world.biome.WorldChunkManager.func_180300_a(WorldChunkManager.java:75) at net.minecraft.world.chunk.Chunk.getBiome(Chunk.java:1442) at net.minecraft.world.World.getBiomeGenForCoordsBody(World.java:196) at net.minecraft.world.WorldProvider.getBiomeGenForCoords(WorldProvider.java:429) at net.minecraft.world.World.getBiomeGenForCoords(World.java:185) at net.minecraftforge.client.ForgeHooksClient.getSkyBlendColour(ForgeHooksClient.java:388) at net.minecraft.world.World.getSkyColorBody(World.java:1524) at net.minecraft.world.WorldProvider.getSkyColor(WorldProvider.java:463) at net.minecraft.world.World.getSkyColor(World.java:1511) at net.minecraft.client.renderer.EntityRenderer.updateFogColor(EntityRenderer.java:1757) at net.minecraft.client.renderer.EntityRenderer.renderWorldPass(EntityRenderer.java:1277) at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1263) at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1088) at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1107) at net.minecraft.client.Minecraft.run(Minecraft.java:376) at net.minecraft.client.main.Main.main(Main.java:117) 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:483) at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source) at GradleStart.main(Unknown Source) Hmm.. IntCache shall not be access from CLIENT thread I thought, because generating biomes is a SERVER function. There must be some better way to implement ForgeHooksClient.getSkyBlendColour I suppose.
-
[1.8, philosophy] 1-character modid curious crash
The code snippet in ResourceLocation below shows how this problem occurs. An 1-character modid would be ignored and replaced with default "minecraft" domain. But still no idea about the intention. // Split "modid:name" into ["modid","name"] protected static String[] func_177516_a(String p_177516_0_) { String[] astring = new String[] {null, p_177516_0_}; int i = p_177516_0_.indexOf(58); if (i >= 0) { astring[1] = p_177516_0_.substring(i + 1, p_177516_0_.length()); if (i > 1) // If length of modid is 1, it's ignored { astring[0] = p_177516_0_.substring(0, i); } } return astring; }
-
Teleporting a Player
When I use /tp command, "Player move too quickly" shows too. So actually it's not a bad way, I suppose.
-
[RESOLVED][1.7.10] How can I make a Battery Item Based In Durability?
Block is an item when in inventory. Extend an ItemBlock class and register your block with it. Then you could do the same thing as a normal Item.
-
[1.8] Slab collision detection
You need to override getCollisionBoundingBox or addCollisionBoxesToList. These two is called during the collision check.
-
[1.8] Custom particles with custom and transparent textures
It didn't change much in 1.8. Some methods of Tessellator is moved to WorldRenderer. And GL11.blabla is replaced by GLStateManager.blabla. getFXLayer is the key of custom particles. In order to use custom textures, it should return 3. GLStateManager.enableAlpha makes textures transparent when rendered.
IPS spam blocked by CleanTalk.