Jump to content

MrRiegel

Members
  • Posts

    47
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Location
    Berlin
  • Personal Text
    Misanthropist, Altruist, Empathizer

MrRiegel's Achievements

Tree Puncher

Tree Puncher (2/8)

1

Reputation

  1. Where do you call ModItems.registerRenders()?
  2. Is it really necessary to create a new capabiliy if I want to add an integer to the player? What about this: player.getEntityData().setInteger("blabla", 1111); ?
  3. Hi, I'm trying to move entities from one dimension to another. The task sounds quite simple. The parameters should look like this: void teleport(Entity entity, int dimension, BlockPos pos) code: Teleporter tele = new PortalTeleporter((WorldServer) target.getWorld(worldObj), tar.selfLanding); if (entity instanceof EntityPlayerMP) { worldObj.getMinecraftServer().getPlayerList().transferPlayerToDimension((EntityPlayerMP) entity, target.getDimension(), tele); } else { worldObj.getMinecraftServer().getPlayerList().transferEntityToWorld(entity, entity.worldObj.provider.getDimension(), (WorldServer) entity.worldObj, (WorldServer) target.getWorld(worldObj), tele); } public class PortalTeleporter extends Teleporter { BlockPos pos; WorldServer world; public PortalTeleporter(WorldServer worldIn, BlockPos pos) { super(worldIn); this.world = worldIn; this.pos = pos; } @Override public void placeInPortal(Entity entityIn, float rotationYaw) { this.world.getBlockState(pos); entityIn.setPosition(pos.getX() + .5, pos.getY() + .05, pos.getZ() + .5); } } It works fine for players but other entities are not working correctly. Sometimes they vanish or duplicate. Some warnings in the logs: [01:56:31] [server thread/WARN]: Wrong location! (12, 10) should be (5, 0), EntityItem['item.item.fireball'/3960, l='New World', x=194,51, y=64,00, z=174,04] [01:56:31] [server thread/WARN]: Tried to add entity Item but it was marked as removed already [01:56:31] [server thread/WARN]: Keeping entity Item that already exists with UUID d27bbf73-764b-4f91-9877-c6679b958684 Is there a better solution for teleporting non-player entities (e.g. mobs,animals,items)? thx
  4. Sorry, that isn't the solution I was looking for. Maybe it will solve the problem for me but not the ones that will use the mod. And even if it works the start still lasts ~5 min. Why do a few blockstate files suck up 2 GB memory? Pressure Pipes and NeoTech use very similar blockstate files for their cables and they don't have that kind of problem. What am I doing wrong?
  5. Hi, I created some cable blocks and I want to render them with json files. But starting MC takes an eternity and in the end it crashs with an OutOfMemoryError. Thats the blockstate file and I have 6 (similiar) more of them: The models look like that just in case the block class Thanks for your help
  6. hey guys here is my problem: Is there a way to make the light more smooth? GlStateManager.pushMatrix(); GlStateManager.enableRescaleNormal(); GlStateManager.translate((float) x + 0.5F, (float) y + 0.5F, (float) z + 0.5F); Minecraft.getMinecraft().renderEngine.bindTexture(texture); GlStateManager.pushMatrix(); GlStateManager.rotate(180F, 0.0F, 0.0F, 1.0F); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); RenderHelper.disableStandardItemLighting(); // RenderHelper.enableStandardItemLighting(); model.render(te); GlStateManager.popMatrix(); GlStateManager.disableRescaleNormal(); GlStateManager.popMatrix(); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
  7. hey guys here is my problem: Is there a way to make the light more smooth? GlStateManager.pushMatrix(); GlStateManager.enableRescaleNormal(); GlStateManager.translate((float) x + 0.5F, (float) y + 0.5F, (float) z + 0.5F); Minecraft.getMinecraft().renderEngine.bindTexture(texture); GlStateManager.pushMatrix(); GlStateManager.rotate(180F, 0.0F, 0.0F, 1.0F); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); RenderHelper.disableStandardItemLighting(); // RenderHelper.enableStandardItemLighting(); model.render(te); GlStateManager.popMatrix(); GlStateManager.disableRescaleNormal(); GlStateManager.popMatrix(); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
  8. I guess you can understand the problem. Running './gradlew eclipse' fix this, but only for this day. On the next day the problem is back. That's annoying. Any ideas? Thanks
  9. It's not MY texture. As you can see in the code I want to render an itemstack in the GUI of an automatic crafter. the itemstack is the crafting result.
  10. How can I render blocks and items semi-transparent? I should look like this: (the right one) this.bindTexture(TextureMap.locationBlocksTexture); BlockRendererDispatcher blockrendererdispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher(); World world = te.getWorld(); BlockPos blockpos = te.getPos(); IBlockState iblockstate = te.getCover().getStateFromMeta(te.getCoverMeta()); GlStateManager.pushMatrix(); RenderHelper.disableStandardItemLighting(); GlStateManager.translate((float) x, (float) y, (float) z); Tessellator tessellator = Tessellator.getInstance(); WorldRenderer worldrenderer = tessellator.getWorldRenderer(); worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK); int i = blockpos.getX(); int j = blockpos.getY(); int k = blockpos.getZ(); worldrenderer.setTranslation(((-i)), (-j), ((-k))); worldrenderer.color(1F, 1F, 1F, 1F); IBakedModel ibakedmodel = blockrendererdispatcher.getModelFromBlockState(iblockstate, world, blockpos); blockrendererdispatcher.getBlockModelRenderer().renderModel(world, ibakedmodel, iblockstate, blockpos, worldrenderer, true); worldrenderer.setTranslation(0.0D, 0.0D, 0.0D); tessellator.draw(); RenderHelper.enableStandardItemLighting(); GlStateManager.popMatrix(); GlStateManager.pushMatrix(); GlStateManager.disableLighting(); GlStateManager.disableDepth(); int j1 = 150; int k1 = 35; GlStateManager.colorMask(true, true, true, false); RenderHelper.enableGUIStandardItemLighting(); GlStateManager.color(1f, 1f, 1f, 1f); ItemStack result = CraftingManager.getInstance().findMatchingRecipe(((ContainerCrafter) inventorySlots).crafter.getMatrix(), mc.theWorld); mc.getRenderItem().renderItemAndEffectIntoGUI(result, j1, k1); RenderHelper.disableStandardItemLighting(); GlStateManager.colorMask(true, true, true, true); GlStateManager.enableLighting(); GlStateManager.enableDepth(); GlStateManager.popMatrix();
  11. @Choonster I did, but I don't get it. The AE code is pretty complicated. @7 Thanks for your hints. A cable should not have a network by itself. A controller is necessary. And of course there's only one controller per network. If I connect 2 networks, one of the controllers drops. current method to fill the list private void addCables(final BlockPos pos) { for (BlockPos bl : getNeighbors(pos)) { if (worldObj.getTileEntity(bl) instanceof TileMaster && !bl.equals(this.pos) && worldObj.getChunkFromBlockCoords(bl) != null && worldObj.getChunkFromBlockCoords(bl).isLoaded()) { worldObj.getBlockState(bl).getBlock().dropBlockAsItem(worldObj, bl, worldObj.getBlockState(bl), 0); worldObj.setBlockToAir(bl); worldObj.removeTileEntity(bl); continue; } if (worldObj.getTileEntity(bl) instanceof IConnectable && !connectables.contains(bl) && worldObj.getChunkFromBlockCoords(bl).isLoaded()) { connectables.add(bl); ((IConnectable) worldObj.getTileEntity(bl)).setMaster(this.pos); addCables(bl); } } }
  12. Hey guys, I created a network with cables and one cable controller (similiar to AE). The list of blockPos of the cables is a field in the cable controller. Every time a cable is placed or removed I need to refresh the entire list (recursive). Problem: If the network has many cables (>500), a refresh decreases the fps. How can I prevent this? AE doesn't have this problem. Can I increases the fps by refreshing the list in another thread?
  13. Hi, I was looking for library mods for 1.8.9 that offers useful methods and classes. for example GUI components, InventoryHelper, RenderHelper or other neat utilities. I could write my own methods and classes but I don't want to overstock the market with another Library Mod and other libraries may be better than mine could ever be. MalisisCore looks pretty useful. CoFHLib too, but it's not available for 1.8.9 yet. Any ideas? thx
  14. Is it possible to make only one json file for any fluid? because the number of fluids is arbitrary. I change the color of the fluids in a config file. And another question: As long as the fluids spreads the fps decrease by 10-20. With water and lava fps is stable. Any idea why? fluids.json { "forge_marker": 1, "defaults": { "model": "forge:fluid" }, "variants": { "normal": [ { "custom": { "fluid": "what name here ?" } } ] } } ModFluids.java public class ModFluids { public static final Map<Integer, Fluid> fluids = Maps.newHashMap(); public final static Map<Integer, CustomBlockFluid> blocks = Maps .newHashMap(); public static void registerFluids(List<CustomFluid> list) { for (int i = 0; i < list.size(); i++) { CustomFluid fluid = list.get(i); registerFluid(fluid, i); } } private static void registerFluid(CustomFluid f, int index) { boolean useOwnFluid = FluidRegistry.registerFluid(f.toFluid()); if (useOwnFluid) { fluids.put(index, FluidRegistry.getFluid(f.name)); registerFluidBlock(f, index); } } private static void registerFluidBlock(CustomFluid fluid, int index) { CustomBlockFluid block = new CustomBlockFluid(fluid); block.setRegistryName("fluid." + block.getFluid().getName()); block.setUnlocalizedName(CustomFluids.MODID + ":" + block.getFluid().getUnlocalizedName()); block.setCreativeTab(CreativeTab.tab1); blocks.put(index, block); GameRegistry.registerBlock(blocks.get(index)); FluidRegistry.addBucketForFluid(FluidRegistry.getFluid(fluid.name)); } } ClientProxy.java public class ClientProxy extends CommonProxy { @Override public void preInit(FMLPreInitializationEvent event) throws IOException { super.preInit(event); registerRenderers(); for (Entry<Integer, Fluid> e:ModFluids.fluids.entrySet()) { Fluid f=e.getValue(); Item fluid = Item.getItemFromBlock(f.getBlock()); ModelBakery.registerItemVariants(fluid); final ModelResourceLocation fluidLocation = new ModelResourceLocation( CustomFluids.MODID + ":fluid"); ModelLoader.setCustomMeshDefinition(fluid, new ItemMeshDefinition() { public ModelResourceLocation getModelLocation( ItemStack stack) { return fluidLocation; } }); ModelLoader.setCustomStateMapper(f.getBlock(), new StateMapperBase() { protected ModelResourceLocation getModelResourceLocation( IBlockState state) { return fluidLocation; } }); } } @Override public void init(FMLInitializationEvent event) { super.init(event); registerItemModels(); } @Override public void postInit(FMLPostInitializationEvent event) { super.postInit(event); } public void registerItemModels() { } public void registerRenderers() { } } CustomFluid.java public class CustomFluid { String name; String displayName; int luminosity; int density = 1000; int temperature = 300; int viscosity = 1000; boolean gas; List<String> biomes; List<Effect> effects; boolean flammable; boolean fireSource; String material; boolean generate; int lakeSize; int chunkChance; int color = 0x6495ED; Design design = Design.WATER; enum Design { WATER, LAVA; ResourceLocation getStill() { if (this == WATER) return new ResourceLocation(CustomFluids.MODID + ":fluid/liquid"); else if (this == LAVA) return new ResourceLocation(CustomFluids.MODID + ":fluid/molten_metal"); return new ResourceLocation(CustomFluids.MODID + ":fluid/liquid"); } ResourceLocation getFlowing() { if (this == WATER) return new ResourceLocation(CustomFluids.MODID + ":fluid/liquid_flow"); else if (this == LAVA) return new ResourceLocation(CustomFluids.MODID + ":fluid/molten_metal_flow"); return new ResourceLocation(CustomFluids.MODID + ":fluid/liquid_flow"); } } public CustomFluid(String name, String displayName, int luminosity, int density, int temperature, int viscosity, boolean gas, List<String> biomes, List<Effect> effects, boolean flammable, boolean fireSource, String material, boolean generate, int lakeSize, int chunkChance, int color, Design design) { this.name = name; this.displayName = displayName; this.luminosity = luminosity; this.density = density; this.temperature = temperature; this.viscosity = viscosity; this.gas = gas; this.biomes = biomes; this.effects = effects; this.flammable = flammable; this.fireSource = fireSource; this.material = material; this.generate = generate; this.lakeSize = lakeSize; this.chunkChance = chunkChance; this.color = color; this.design = design; } public Fluid toFluid() { return new Fluid(name, null, null) { @Override public String getLocalizedName(FluidStack stack) { return displayName; } @Override public int getColor() { int c = color; if (((c >> 24) & 0xFF) == 0) { c |= 0xFF << 24; } return c; } @Override public ResourceLocation getStill() { return design.getStill(); } @Override public ResourceLocation getFlowing() { return design.getFlowing(); } }.setLuminosity(luminosity).setDensity(density) .setTemperature(temperature).setViscosity(viscosity) .setGaseous(gas); } }
×
×
  • Create New...

Important Information

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