jabelar
Members-
Posts
3266 -
Joined
-
Last visited
-
Days Won
39
Everything posted by jabelar
-
I have a tutorial on entity sounds here: http://jabelarminecraft.blogspot.com/p/minecraft-forge-1721710-organizing-and.html
-
There are several methods related to blocks and fire: isBurning() indicates whether it is on fire and whether it will cause other things that touch it to burn. getFlammability() returns chance that fire will spread and consume this block isFlammable() returns true if getFlammability() > 0 getFireSpreadSpeed() indicates how it spreads to neighbors isFireSource(), if true will keep fire on top of it burning without dying out or getting rained out. I think you'll want to @Override the getFlammability() method to return 0 so it won't burn. And you might want to have isFireSource() return true if you want fire to keep burning on it without dying out.
-
[Solved][1.7.x] Clarification on some block rendering stuff
jabelar replied to jabelar's topic in Modder Support
I didn't exactly solve it, but rather have played around to get things working well enough. I still think that the "opaque" and "normal" descriptions are a bit confusing by combining rendering behavior with other behavior. -
[Solved][1.7.x] Clarification on some block rendering stuff
jabelar replied to jabelar's topic in Modder Support
Also, how does this all work with Materials. I notice they have an isSolid() and isOpaque() method. There is also an setTranslucent() method? I'm thinking the proper way to do it is create custom material and then make sure the custom material passes the material values. Like the block's isOpaque() should just call the material's isOpaque(). Is that the "proper" way to do it? It seems that the setTranslucent() is important to let light go through? Except it is a private field in Material class...which brings up question on whether a custom material should extend Material, or should I just call Material and use its methods to create new material. I'm thinking the latter. -
[Solved][1.7.x] Clarification on some block rendering stuff
jabelar posted a topic in Modder Support
Okay, I'm making a cloud block that can be walked on but want to play around with transparency, opaqueness, etc to get a visual effect that I like. I can find a lot of methods that I know are related to controlling this stuff, but it is not clear to me how they all inter-work. Here's what I I think I know (please confirm or correct): - getRenderBlock() should return 1 to allow alpha transparency (which I want). Is the alpha just whatever I put in the texture, or is there another additional alpha control? If I want to control the alpha separately from the texture, do I need to do a custom render? - renderAsNormalBlock() should return true since I want a square normal block shape, right? - isOpaqueCube() should return false since I want light to go through it, right? This then enables lightOpacity to have effect? Why does the comments also mention that it indicates full cube and that torches and such can be attached? - lightOpacity should be something less than 255 because I want some light to go through it, but bit of blocking? Here's where I need a bit of confirmation: - getLightValue() comment mentions arguments as x, y, z, but in Block base class doesn't seem to pass those? Here is Block class method: /** * Gets the light value of the specified block coords. Args: x, y, z */ public int getLightValue() { return this.lightValue; } I am possibly interested in a bit of light emanating from the block because these clouds are supposed to be sort of "heavenly". So I want to play around with this a bit. But how come BlockGlowStone doesn't do anything with this? Where does the glow from glowstone come from? - getUseNeighborBrightness() not sure if I need to do anything with this, I think not? - isBlockNormalCube() seems to be combination of whether it blocks movement and renders normally. If I did end up doing a custom render or some reason, would I want this to return false? Why do they combine both movement and rendering in one check??? - isNormalCube() seems to add on to isBlockNormalCube() with check for power transmission. - func_149730_j() seems to just return the opaque field value. Not sure how that is used differently compared to isOpaqueCube() method. - getMixedBrightnessForBlock(). What should I do with that method, if anything? Anyway, if someone could sort of help me sort out what of the above is important to make a semi-transparent, possibly slightly light-emanating block. I think my confusion stems from some of the names like "opaque" also seeming to have implications on "solid". Maybe the naming is poor. I'd prefer for the rendering functions and the functions for collisions and attaching all be more distinct. -
How do I make my mob attack attackers like wolves?
jabelar replied to UntouchedWagons's topic in Modder Support
For the problem of an entity trying to attack without doing damage, I have a tutorial for that: http://jabelarminecraft.blogspot.com/p/minecraft-forge-1721710-custom-entity.html -
okay figured it out. and it was dumb. I forge to run gradlew setupDecompWorkspace after I first created the local working copy. Doh!
-
Sorry, not sure. I've only used fogdensity for a general fog effect, not for just one block type.
-
I believe Vic_ on Minecraftforum.net modding forum maintains it. You should PM him/her there. However, I am not sure you are correct. The ServerTickEvent is in the FMLCommonHandler package and if you check the call hierarchy is is posted onto the FML bus... Why do you think it is posted on EVENT_BUS?
-
I'm not sure setting the density to 2 is good idea. I think density is meant to be a percentage where 1.0F is fully thick (can't see anything). Have you tried playing with fog density without testing the blocks? First just get it so fog is generally doing what you want then try limiting to various blocks.
-
how high would I be able to make the chance without a tile entity? I'm getting a little confused following this conversation. If you want a chance of something you just have to generate random number on some frequent basis (ticks or random ticks) and check if the random number hit the chance you wanted. You can calculate it, but you can also just try some values until you get it how you like. If you don't know how to generate random numbers and check for chance, that is basic Java and there are plenty of examples out there. But as simple explanation if you wanted a 3 % chance you'd generate a random number between 0 and 99 and then check if the number returned was <= 2. After that the question is timing. Do you want 3% chance that it converts every tick (there are 20 ticks per second), or do you want 3% chance that it converts within a minute? You would just adjust the chance testing based on the frequency of checking until it gets to right point. For example, if you want 3% chance that it converts in 1 minute, you could just check every minute, or you could check for 1.5% chance every half minute, or 0.75% chance four times a minute.
-
I have a tutorial on custom entities. Might give you some ideas: http://jabelarminecraft.blogspot.com/p/creating-custom-entities.html
-
What happens if you return 0xFFFFFF (i.e. white instead of black)?
-
I think it may be related to the AI. Basically, with computer enemies you usually don't want them to be perfect because then they would be unbeatable. So in most games the AI only occasionally checks if the non-player character will act. For many entities, they use the "new AI" system that consists of a couple lists of AI task classes which have a priority and also a mutually exclusive masking property. So for example an entity won't decide to wander or mate if it is in the middle of an attack, etc. For your mob, are you using the AI or are you inheriting AI due to extending an entity class? If so, then you might need to change the list of AI, possibly replacing with your custom AI, or you can also go back to the "old AI" which was pretty much just writing all your code into the onUpdate() method. Anyway, the first thing I would suggest is to change the priority order of the attack AI tasks. You can rebuild the AI lists by simply clearing them (they are just a list) and then adding tasks back. I have a tutorial on AI which you might find useful: http://jabelarminecraft.blogspot.com/p/minecraft-forge-1721710-custom-entity-ai.html
-
I think render type 2 is for torches. Is that the type of render you want? You can see a list of all the render types in the renderBlockByRenderType() method which has the following: case 0 : return this.renderStandardBlock(p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) ; case 4: return this.renderBlockLiquid(p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) ; case 31: return this.renderBlockLog(p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) ; case 1: return this.renderCrossedSquares(p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) ; case 40: return this.renderBlockDoublePlant((BlockDoublePlant)p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) ; case 2: return this.renderBlockTorch(p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) ; case 20: return this.renderBlockVine(p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) ; case 11: return this.renderBlockFence((BlockFence)p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) ; case 39: return this.renderBlockQuartz(p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) ; case 5: return this.renderBlockRedstoneWire(p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) ; case 13: return this.renderBlockCactus(p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) ; case 9: return this.renderBlockMinecartTrack((BlockRailBase)p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) ; case 19: return this.renderBlockStem(p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) ; case 23: return this.renderBlockLilyPad(p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) ; case 6: return this.renderBlockCrops(p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) ; case 3: return this.renderBlockFire((BlockFire)p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) ; case 8: return this.renderBlockLadder(p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) ; case 7: return this.renderBlockDoor(p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) ; case 10: return this.renderBlockStairs((BlockStairs)p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) ; case 27: return this.renderBlockDragonEgg((BlockDragonEgg)p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) ; case 32: return this.renderBlockWall((BlockWall)p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) ; case 12: return this.renderBlockLever(p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) ; case 29: return this.renderBlockTripWireSource(p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) ; case 30: return this.renderBlockTripWire(p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) ; case 14: return this.renderBlockBed(p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) ; case 15: return this.renderBlockRepeater((BlockRedstoneRepeater)p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) ; case 36: return this.renderBlockRedstoneDiode((BlockRedstoneDiode)p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) ; case 37: return this.renderBlockRedstoneComparator((BlockRedstoneComparator)p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) ; case 16: return this.renderPistonBase(p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_, false) ; case 17: return this.renderPistonExtension(p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_, true) ; case 18: return this.renderBlockPane((BlockPane)p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) ; case 41: return this.renderBlockStainedGlassPane(p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) ; case 21: return this.renderBlockFenceGate((BlockFenceGate)p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) ; case 24: return this.renderBlockCauldron((BlockCauldron)p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) ; case 33: return this.renderBlockFlowerpot((BlockFlowerPot)p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) ; case 35: return this.renderBlockAnvil((BlockAnvil)p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) ; case 25: return this.renderBlockBrewingStand((BlockBrewingStand)p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) ; case 26: return this.renderBlockEndPortalFrame((BlockEndPortalFrame)p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) ; case 28: return this.renderBlockCocoa((BlockCocoa)p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) ; case 34: return this.renderBlockBeacon((BlockBeacon)p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) ; case 38: return this.renderBlockHopper((BlockHopper)p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_); default: return FMLRenderAccessLibrary.renderWorldBlock(this, blockAccess, p_147805_2_, p_147805_3_, p_147805_4_, p_147805_1_, l);
-
Entity Modding- ClientProxy and Render class errors
jabelar replied to Anuwa's topic in Modder Support
Your entity class doesn't seem to extend any Entity class. That is why you can't cast an Entity to it. -
Your getIcon method seems maybe a bit unnecessarily complicated. How many grow stages do you have textures for? In my crop I have 4 textures so I use the following code. There are 8 grow stages for crops (0 to 7), so I duplicate entries in an icon array to fill it up, like this: @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister parIIconRegister) { iIcon = new IIcon[8]; // seems that crops like to have 8 growth icons, but okay to repeat actual texture if you want iIcon[0] = parIIconRegister.registerIcon("recipeplus:blueberries_stage_0"); iIcon[1] = parIIconRegister.registerIcon("recipeplus:blueberries_stage_0"); iIcon[2] = parIIconRegister.registerIcon("recipeplus:blueberries_stage_1"); iIcon[3] = parIIconRegister.registerIcon("recipeplus:blueberries_stage_1"); iIcon[4] = parIIconRegister.registerIcon("recipeplus:blueberries_stage_2"); iIcon[5] = parIIconRegister.registerIcon("recipeplus:blueberries_stage_2"); iIcon[6] = parIIconRegister.registerIcon("recipeplus:blueberries_stage_3"); iIcon[7] = parIIconRegister.registerIcon("recipeplus:blueberries_stage_3"); } And then in the getIcon() method it can be really simple: @Override @SideOnly(Side.CLIENT) public IIcon getIcon(int parSide, int parGrowthStage) { return iIcon[parGrowthStage]; } Note I have a whole tutorial on crops: http://jabelarminecraft.blogspot.com/p/minecraft-forge-172-creating-custom.html
-
What exactly are you trying to do? The PotionBrewedEvent fires right when it is ready to finish brewing and output the resulting potions. Do you want to change the brewing recipe instead?
-
In programming you have to pay close attention to the console log. It tells you exactly what type of problem is occurring and even the line of your code where the problem manifests (note that the actual problem might be somewhere else in your code, but the line indicated is where the error first causes trouble). You do have several errors related to registering an attribute that is already registered. Why don't you fix that error and then post the resulting log after that is fixed, and we can tackle the remaining errors. You may also want to look at my tutorial on custom entities as well, maybe information there might give you hint on something that may be wrong: http://jabelarminecraft.blogspot.com/p/creating-custom-entities.html I think that some of your other errors are related to mixing the types of entity registrations -- there was an older global ID style, and a newer mod ID style. Anyway, clear out the one error and then let's tackle the next.
-
Well the event parameter passes the entity that is hurt plus the damage source. Check that the damage source is player and that it is equipped with your special sword. If true teleport the hurt entity.
-
I gave you an example, you should copy it. You have to pass the event type as the parameter -- that is how it knows what your are subscribed to. So you can't pass the itemstack, you need to pass the PotionBrewedEvent.
-
The problem with your code is that by extending the event you are basically creating a new event. That's not what you want to do; instead you need to handle the existing event. So first of all, your event handling class shouldn't extend anything. Just be a class on its own. Secondly, the methods in your event handling class need to be annotated with @SubscribeEvent. Just put this right before each method. Then to make sure it is subscribed to the event you want, the parameter passed to the method should be the event you want to listen for. For example: @SubscribeEvent(priority=EventPriority.NORMAL, receiveCanceled=true) public void onEvent(PotionBrewedEvent event) { System.out.println("A potion was brewed!"); } Then you have to make sure the whole class is registered to the right event bus. For general information on that, please see my tutorial: http://jabelarminecraft.blogspot.com/p/minecraft-forge-172-event-handling.html Lastly you need to put some code into the method that does what you want. The key is that the event parameter contains fields that are useful for the particular event. In this case there is event.brewingstacks which passes whatever has been brewed (note it could be null).
-
Actually, those are both right-click. onItemUse is when a block is right-clicked with your Item and onItemRightClick when the player just right-clicks the Item (without aiming at a block). Thanks for the correction. I always thought those seemed redundant but that makes sense. So for left click what is correct method? There is onLeftClickEntity() which is for attack I assume, but what about for block? Or do you have to handle that from the block class?
-
Like I said, you should just look up examples in regular Java. I understand that file I/O in any computer language can be a bit confusing, but I already gave you an example on how to read a file from your assets folder into a buffer. Then you just need standard Java to output the buffer with file writer type code.
-
If it is your own custom item that does this, you should be able to do it directly from the item's code without an event. (I like events and it will work to use events, but philosophically it is more logical to do it in your custom item if you have that opportunity). So just code it in the onItemRightClick() or onItemUse() depending on whether it is right click or left click activated.