-
Posts
884 -
Joined
-
Last visited
-
Days Won
9
Everything posted by Jay Avery
-
It won't be the capability that's null, it's probably getMinecraft() or player. Step through with the debugger or use printlns if you want to find out for sure. But you don't really need to, because you don't need to be using that code at all - event#player won't be null.
-
Does your DreamWorldProvider class extend WorldProvider?
-
creating stone layers using WorldGenerator 1.10.2
Jay Avery replied to Burpingdog1's topic in Modder Support
If you want your WorldGenerator to do something, you need to put code in the generate method. In your case, code to find stone blocks below a certain height and replace them with your block. -
[1.11.2] [Solved] Changing Break Speed With Hoe
Jay Avery replied to Debu922's topic in Modder Support
(Welcome!) You can use the PlayerEvent.BreakSpeed event to adjust the time taken to break a block. Also, you might be better off using HarvestDropsEvent to edit the drops from a block based on the harvesting tool. That way you don't have to cancel and re-do the block break itself, you can just alter the items being dropped. -
Cant figure out how to pass Entity targetPos to task AIGoto
Jay Avery replied to clowcadia's topic in Modder Support
if(nbt==null) nbt = new NBTTagCompound(); if(nbt.hasKey("targetX")){ When you create a brand new tag compound, it's never going to already have a given key - perhaps you meant to check if it doesn't have that key? In gameplay terms, how do you want the ItemStack's target information to be given to the entity? Do you put the stack in the entity's inventory? Is the information sent to the entity as soon as the target is clicked? -
You shouldn't be using Minecraft.getMinecraft().player. The Minecraft class doesn't exist on the server so it will cause a crash. It also bears no relation to the event you're subscribing to - instead you should get the player from the event, event#player.
-
You need to create a WorldGenerator object for your ore and call generate() on it - either construct an instance of a vanilla class (WorldGenMinable is used for most vanilla ores so could be fine for your purposes) - or make your own implementation for specific generation rules. Take a look at the vanilla WorldGen___ classes to see how they work (they're in net.minecraft.world.gen.feature)
-
You're calling generateOre, which is a method that does nothing.
-
Cant figure out how to pass Entity targetPos to task AIGoto
Jay Avery replied to clowcadia's topic in Modder Support
Compare the Item directly. Items are singletons so can be compared just using the == operator. -
Item#onItemUse has a BlockPos parameter for the targeted block.
-
What do you mean? Exactly what position do you want to find?
-
Allow an entity to pass through certain blocks
Jay Avery replied to Jay Avery's topic in Modder Support
I found that event, but I don't know how I would go about removing the collision boxes of specific block types, since the event just contains a list of AxisAlignedBB. Is there a way to find out the block that each collision box comes from? -
I'm making an entity, and I want it to be able to move through certain block types (but not ALL block types) as if they're air - no collisions etc. Is there any way to do this? I've been looking through the Entity code but I'm just really confused. I can't seem to find where block collisions actually happen, only collisions with other entities.
-
It's kind of hard to describe this in an abstract way so I'll just give my specific example: I'm trying to do various things with trees (e.g. make a whole tree fall when the trunk breaks) that require 'finding' every log and leaf block that's part of the tree. I'm just having trouble figuring out the most efficient way to do that. My first (obvious) idea was to just search a cuboid of co-ordinates, checking every block and selecting it if it's log or leaves. The trouble with this is that it risks selecting blocks that belong to other nearby trees, plus it involves probably checking the state of loads of unnecessary air blocks which is surely bad for performance. A better idea would be some kind of cleverer searching that moves from one block to the next and stops if it hits air. But I don't really know how I would begin making something like this - something like recursion to check all adjacent blocks at each block? Maybe that would end up being just a performance heavy as the first option, I don't know! My best idea to avoid bringing down blocks from nearby trees is to keep a count of how many leaves have been selected and just stop after a certain limit is reached. But that means that whatever searching method I use needs to start from the centre of the tree and work outwards evenly, otherwise it risks selecting all the leaves from one side of a cuboid and leaving loads behind (or similar issues). Does anyone have any suggestions for this? Examples of similar functionality would be appreciated, as would information about this stuff in general coding terms (I feel like 3D searching algorithms are surely something that people will have studied a lot, but I have no idea how to find out about that, I'm just a self-taught amateur). Edit: An update for anyone who's interested. I've made a searching algorithm that finds all connected trunk blocks, and connected leaves up to a certain count, starting closest to the trunk. I use it in this method, (and use the search results to make all the tree blocks fall). If anyone has ideas on how to improve the performance I'd be grateful - I know I've used several different collections to keep track of all the checking but I couldn't think of any way to reduce that further.
-
That's right, file names too.
-
All asset paths have to be entirely lowercase in 1.11+.
-
Close - the inventory line should be inside the variants brackets, and don't forget a comma between each element: { "variants": { "normal": { "model": "parallelworlds:night_ore" }, "inventory": {"model": "parallelworlds:night_ore"} } }
-
That means there's no Item model for the associated ItemBlock. You can either add an item model in your models/item folder, or add an inventory variant in your blockstates file (probably to the same block model if you want to it to appear as an ordinary block).
-
Can you clarify what you mean by this? (Screenshots perhaps?)
-
I've made a block which has a TE that extends TileEntityChest. I want the block to render with an ordinary static model (not a TESR) - I've got a blockstates file and model and I know they're correct because that model is used when it's an inventory item. But when I place the block in the world, it renders as a vanilla chest instead of my block model. I've overriden getRenderType to return MODEL, but that's apparently being ignored. The block class does not extend the vanilla chest block, only the TE extends the vanilla TileEntityChest. How can I force it to render as a block model instead of the vanilla TESR? For reference, my block class: My TileEntity:
-
Give achievement based on item in hand.
Jay Avery replied to ModderInTraining's topic in Modder Support
Your brackets are in the wrong places. This is really basic Java stuff that you're struggling with. I'm going to highlight each pair of opening and closing brackets in different colours so you can see: if(TitaniumArmorPeices == 4) { if(player.getHeldItemMainhand().getItem().equals(ModCombat.titaniumSword)) { if(player.getHeldItemOffhand().getItem().equals(ModCombat.titaniumShield)) { } } } if(player.hasAchievement(AchievementHandler.achievementBulletProof)) { if(!player.hasAchievement(AchievementHandler.achievementBattleReady)) { player.addStat(AchievementHandler.achievementBattleReady); } } The red brackets are executed if the offhand item is a titaniumShield. The blue brackets are executed if the mainhand item is a titaniumSword. Can you see that both of those brackets have no actual code inside? -
Tooltip that varies depending on the container
Jay Avery replied to Zacomat's topic in Modder Support
My first idea would be to check EntityPlayer#openContainer and see whether it's an instance of ContainerPlayer or something else. -
Give achievement based on item in hand.
Jay Avery replied to ModderInTraining's topic in Modder Support
I gave a list of the problems with your code, so try fixing those and then show us what you have if it still doesn't work as you want. -
You're getting closer! Now you should just need to change implements IRenderFactory<EntityMob> to implements IRenderFactory<EntityTameable> so that the generic type matches the superclass of your mob everywhere it's used. Edit: ah yep, you cracked it.
-
Show your Test and RenderTestFactory classes. It's probably to do with the hierarchy in your generics.