Jump to content

Blargerist

Members
  • Posts

    16
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

Blargerist's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. During the World initialization method, when it asks the DimensionManager for its WorldProvider, I have to build a custom WorldProvider for it. During that building process, I need to set some custom renderers. Setting renderers of the server side, causes some issues, namely crashing.
  2. I need to be able to check if things are running on the client or server side. As I could need this information before any world is finished initializing, there is no world object for me to check. I'm looking for the best way to check. Found this method, but it says "Use at your own risk" which makes me uneasy: FMLCommonHandler.instance().getEffectiveSide() Is there a better way? Solved: Use a sided proxy.
  3. While I can't give you any suggestions for tutorials(as I've never seen one), I thought I would warn you about some potential problems you may run into while trying to do utility development for modded servers. Probably the biggest problem, is that many events you may want to use for things like protection simply don't exist in forge(such as endermen block interaction). Any missing events would need to created for yourself using ASM, which is a bytecode manipulation framework, and ASM is a little bit harder than just basic modding. The alternative to using ASM to create your own events, would be to do as Anon10W1z suggested, and use Cauldron for the server, allowing Bukkit plugins. While Bukkit has a much larger range of events, Cauldron doesn't always play nice with all mods, and Bukkit events have a tendency to not be triggered by modded items(GriefPrevention Bukkit plugin vs Thaumcraft wand of excavation). Basically, Forge has infinite possibilities, but it'll take a lot of work to realize them. While Bukkit is easier, but will probably not interact with mods quite how you would like. If you have any questions about specific things (Forge code/ASM/Bukkit theory) feel free to send me a message and I'll do my best to help you out, as I've gone into a lot of these things before.
  4. I would imagine that Draco is trying to point out that with "if(event.source.equals("player"))" you're trying to compare a DamageSource with a String. Since I don't see any methods within DamageSource that handles such a comparison, I would think that you'll need to use a method within DamageSource to return the String representation of the damage type for comparison.
  5. I assume the happenings in my last post has to do with the "minimum light level" of sorts that the end dimension has, and is therefore utterly useless in this situation. Is there no way to set the brightness of an entity regardless of it's position partially inside a block in the world? Not that I haven't tried and failed to do such with things like tesselator.setBrightness(255);. It would be highly unfortunate if it's simply a reality that cannot be circumvented in any way short of changing the minimum light level of the dimension. Very much ruins the aesthetic....
  6. Well, tested things a bit because it appeared the dragon could still render properly while moving through blocks. It seems that even my entity is able to properly render while moving through blocks in the end dimension. Happen to know what it is about the end dimension that allows this?
  7. Rendering code defeats me. I am currently working on a mod which adds the ability for one to add physics movement to any block. At times when the entities created for these moving blocks are required to move through blocks placed within the world using noClip. While an entity is passing through a block, it is rendered as a pure black cube. While an entity is not passing through a block, it is rendered perfectly. As this mod is meant to be compatible with any block(vanilla or modded), I am editing base EntityFallingBlock classes and making changed/calling my own classes as required. Therefore, most code being used is purely vanilla. Modified version of net/minecraft/client/renderer/entity/RenderFallingBlock.doRender method: public void doRender(EntityFallingBlock p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_) { World world = p_76986_1_.func_145807_e(); Block block = p_76986_1_.func_145805_f(); int i = MathHelper.floor_double(p_76986_1_.posX); int j = MathHelper.floor_double(p_76986_1_.posY); int k = MathHelper.floor_double(p_76986_1_.posZ); GL11.glPushMatrix(); GL11.glTranslatef((float) p_76986_2_, (float) p_76986_4_, (float) p_76986_6_); this.bindEntityTexture(p_76986_1_); GL11.glDisable(GL11.GL_LIGHTING); Tessellator tessellator; if (block instanceof BlockAnvil) { this.field_147920_a.blockAccess = world; tessellator = Tessellator.instance; tessellator.startDrawingQuads(); tessellator.setTranslation((double) ((float) (-i) - 0.5F), (double) ((float) (-j) - 0.5F), (double) ((float) (-k) - 0.5F)); this.field_147920_a.renderBlockAnvilMetadata((BlockAnvil) block, i, j, k, p_76986_1_.field_145814_a); tessellator.setTranslation(0.0D, 0.0D, 0.0D); tessellator.draw(); } else if (block instanceof BlockDragonEgg) { this.field_147920_a.blockAccess = world; tessellator = Tessellator.instance; tessellator.startDrawingQuads(); tessellator.setTranslation((double) ((float) (-i) - 0.5F), (double) ((float) (-j) - 0.5F), (double) ((float) (-k) - 0.5F)); this.field_147920_a.renderBlockDragonEgg((BlockDragonEgg) block, i, j, k); tessellator.setTranslation(0.0D, 0.0D, 0.0D); tessellator.draw(); } else { this.field_147920_a.setRenderBoundsFromBlock(block); RenderFallingBlocks.renderBlockSandFalling(this.field_147920_a, block, world, i, j, k, p_76986_1_.field_145814_a); } GL11.glEnable(GL11.GL_LIGHTING); GL11.glPopMatrix(); } My RenderFallingBlock class: public class RenderFallingBlocks { public static void renderBlockSandFalling(RenderBlocks renderBlocks, Block block, World world, int x, int y, int z, int meta) { if (!block.renderAsNormalBlock()) { if (block.getRenderType() == 18) { renderBlocks.renderBlockSandFalling(block, world, x, y, z, meta); } else { renderBlocks.renderBlockAsItem(block, meta, 0.8F); } } else { int colormult; if (block instanceof BlockLeaves) { colormult = colorLeaves(world, x, z, meta); } else { colormult = block.colorMultiplier(world, x, y, z); } float cm1 = (float) (colormult >> 16 & 255) / 255.0F; float cm2 = (float) (colormult >> 8 & 255) / 255.0F; float cm3 = (float) (colormult & 255) / 255.0F; renderBlocks.enableAO = false; boolean var9 = false; float var10 = 0.5F; float var11 = 1.0F; float var12 = 0.8F; float var13 = 0.6F; float var14 = var11 * cm1; float var15 = var11 * cm2; float var16 = var11 * cm3; float var17 = var10 * cm1; float var18 = var12 * cm1; float var19 = var13 * cm1; float var20 = var10 * cm2; float var21 = var12 * cm2; float var22 = var13 * cm2; float var23 = var10 * cm3; float var24 = var12 * cm3; float var25 = var13 * cm3; Tessellator tesselator = Tessellator.instance; tesselator.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z)); tesselator.startDrawingQuads(); tesselator.setColorOpaque_F(var17, var20, var23); renderBlocks.renderFaceYNeg(block, -0.5D, -0.5D, -0.5D, block.getIcon(0, meta)); tesselator.setColorOpaque_F(var14, var15, var16); renderBlocks.renderFaceYPos(block, -0.5D, -0.5D, -0.5D, block.getIcon(1, meta)); tesselator.setColorOpaque_F(var18, var21, var24); renderBlocks.renderFaceZNeg(block, -0.5D, -0.5D, -0.5D, block.getIcon(2, meta)); tesselator.setColorOpaque_F(var18, var21, var24); renderBlocks.renderFaceZPos(block, -0.5D, -0.5D, -0.5D, block.getIcon(3, meta)); tesselator.setColorOpaque_F(var19, var22, var25); renderBlocks.renderFaceXNeg(block, -0.5D, -0.5D, -0.5D, block.getIcon(4, meta)); tesselator.setColorOpaque_F(var19, var22, var25); renderBlocks.renderFaceXPos(block, -0.5D, -0.5D, -0.5D, block.getIcon(5, meta)); tesselator.draw(); } } public static int colorLeaves(World par1World, int par2, int par4, int var5) { if ((var5 & 3) == 1) { return ColorizerFoliage.getFoliageColorPine(); } else if ((var5 & 3) == 2) { return ColorizerFoliage.getFoliageColorBirch(); } else { int var6 = 0; int var7 = 0; int var8 = 0; for (int var9 = -1; var9 <= 1; ++var9) { for (int var10 = -1; var10 <= 1; ++var10) {//64 Is a guess int var11 = par1World.getBiomeGenForCoords(par2 + var10, par4 + var9).getBiomeFoliageColor(par2 + var10, 64, par4 + var9); var6 += (var11 & 16711680) >> 16; var7 += (var11 & 65280) >> 8; var8 += var11 & 255; } } return (var6 / 9 & 255) << 16 | (var7 / 9 & 255) << 8 | var8 / 9 & 255; } } } I believe all other rendering related code is vanilla. Any ideas on how to cause the entity to render properly while passing through blocks would be apreciated. I imagine code related to the EnderDragon contains what I require, but I can't exactly find it. Simple problem explanation: Entity moving through a block in the world renders as pure black.
  8. By "bounding box" I mean whichever collision box within an entity stop the entity from moving inside of a block in the world. Apologies if I'm using the wrong term. Ok, let me try to explain better what the effect I'm going for is. Imagine if a block of sand could slide off of a block it's sitting on top of, rather than simply being able to fall straight downwards when it has nothing below it. The EntityFallingBlock created for this , with its 0.98 x 0.98 bounding box, would only be able to move straight to the side by 1 block, before it would be able to fall downwards. The effect I'm after, is allowing the entity to move in an arcing motion, closer to a 45 degree angle. One might think that simply making a smaller bounding box for the entity would work, but the entity needs to extend far enough in each direction in order to properly collide with blocks on the ground before placement. In order to collide/not collide at the right time, it would effectively need an approximated diamond shape. I'm currently leaning towards using temporary noClip for this instead of messing with the bounding box, I'm just seeing what my options are. If that makes no sense(which it probably doesn't), I'm basically asking if it's somehow possible to make a more complex bounding box out of multiple cubes instead of a single cube.
  9. In the interest of making things pretty, I'm wanting to make it appear that my entity(which is similar to EntityFallingBlock) partially slides through blocks when moving horizontally and vertically at the same time. Unfortunately since Minecraft uses axis aligned bounding boxes, it's not exactly possible to simply rotate the bounding box. Is there any way to perhaps combine multiple axis aligned bounding boxes to create an approximation of a rotated bounding box? I know things like the Ender Dragon use multiple child entities in order to create a more complex box. Is child entities the only possible way? If so, I'm not sure prettiness would be worth the extra server load. noClip is of course an option for causing the same sliding effect, but I am hoping to avoid handling turning that on/off at the correct times.
  10. First thought after watching the video is that the "barrier" is most likely caused by a both the client and the server ran the code for the explosion, causing blocks to be destroyed, but not exactly the same blocks on both sides. The "barrier" is that the block you're trying to enter (which doesn't exist on client side) does exist on the server side. Reloading the world simply syncs the data between the server and client, which is why it fixes the problem. You might want to try adding an if (!world.isRemote) check in your code to be sure the blocks are only destroyed on server side.
  11. Created a base extension of EntityFallingBlock before I start overriding anything, to be sure everything works and I have a stable baseline. public class EntityMovingBlock extends EntityFallingBlock { public EntityMovingBlock(World p_i1706_1_) { super(p_i1706_1_); } public EntityMovingBlock(World p_i45318_1_, double p_i45318_2_, double p_i45318_4_, double p_i45318_6_, Block p_i45318_8_) { super(p_i45318_1_, p_i45318_2_, p_i45318_4_, p_i45318_6_, p_i45318_8_); } public EntityMovingBlock(World p_i45319_1_, double p_i45319_2_, double p_i45319_4_, double p_i45319_6_, Block p_i45319_8_, int p_i45319_9_) { super(p_i45319_1_, p_i45319_2_, p_i45319_4_, p_i45319_6_, p_i45319_8_, p_i45319_9_); } } Register it: EntityRegistry.registerModEntity(EntityMovingBlock.class, "entityMovingBlock", 1, instance, ModConfig.fallRange + 50, 3, true); Test run comes up with a crash when I create one, even though I've changed nothing from the vanilla class. EntityMovingBlock entityfallingblock = new EntityMovingBlock(world, (double) ((float) x + 0.5F), (double) ((float) y + 0.5F), (double) ((float) z + 0.5F), block, meta); entityfallingblock.func_145806_a(true); world.spawnEntityInWorld(entityfallingblock); In my mind this point towards an instance of my entity being created using the <init>(World) method for some odd reason. Changing that method to private came up with an error pointing towards where it was being called from: (a forge method out of my control) I suppose I could just extend onUpdate() and catch/kill any null entities created, but that hardly seems like a good way to do things. Why are these entities being created and updated using a constructor I didn't specify? As a test I tried to register it as a global entity like vanilla(which is bad, and I would rather not do): EntityRegistry.registerGlobalEntityID(EntityMovingBlock.class, "entityMovingBlock", 217, Color.red.getRed(), Color.blue.getBlue()); Worked perfectly without crashing. I would obviously rather not register it as a global entity, as it kills things like compatability; So why does it create and update these bad entities if registered as a mod entity? What would be the best way to fix this? EDIT: Rooky mistake. Simply expected too much of a vanilla entities methods to work with a mod entity. Almost no point overriding EntityFallingBlock, most methods need to be overridden in order to even get the same thing. It appears the null entities were being created to read info from NBT and write themselves into non-null entities. Didn't expect it because of an assumption that the vanilla EntityFallingBlock read/write NBT methods would work for a mod entity, which they don't. FIXED: Handle everything myself instead of expecting inherited methods to work.
  12. Now I know, and knowing is half the battle! Thank you my lord! -bow- And thank you shieldbug1!
  13. Not gonna lie, I'm just too lazy/annoyed to figure out a solution to this at the moment. So the code I currently have gets the unlocalizedName of a block and saves it as a variable. I get that variable from another class and use Block.getBlockFromName() to get an instance of the block in order to be able to use things like .getMaterial(). Basically this: (Obviously not real code) public String blockName; blockName = SomeBlock.getUnlocalizedName(); Material material = Block.getBlockFromName(blockName.subString(5)).getMaterial(); This usually seems to work fine.... When I do this with something like soul sand though, it crashes. I found out that this is because while the unlocalizedName variable in the soul sand class is "hellsand", it is added to the block registry as "soul_sand". This of course causes a problem. -Insert rant about how something like this shouldn't even be an issue- Is there some other way I should be getting a blocks name? Perhaps Block.blockRegistry.getNameForObject(SomeBlock) which for soul sand returns "minecraft:soul_sand"? I could obviously just save the block itself as a variable instead of it's name, but I feel like that would be a little less efficient.
  14. Haha, of course! As usual, the thing I got stuck on was obvious from outside the cloud of frustration . Wish I had thought to check the thread again before deleting literally everything and re-downloading to be sure it wasn't a corruption issue . Now to just think of some other way to verify variables are correctly targeted (without using a second transformer ). Can't think of a different approach yet though.... I feel properly dumb now . Many thank yous diesieben07!
×
×
  • Create New...

Important Information

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