Everything posted by Draco18s
-
[1.10.2] Getting crafting/smelting recipe from item
Getting the recipe result while looping through the crafting list is very easy, as the IRecipe interface includes getRecipeOutput() . So that'll let you narrow in on the right recipe quickly. From there, you just need to convert it to the proper recipe class (there are several) and get the inputs. Do note that (most!) tools are of type ShapedOreRecipe and they're made up of lists of items in each slot, rather than a single item (I had to write a recipe comparison function last night that would take in an arbitrary recipe and find recipe with the same pattern, but using a different material: i.e. given the recipe for a wooden axe, find the recipe for the golden axe; that was fun).
-
[1.10+] ItemHandler Output Slots
Hmm. That sounds pretty reasonable, actually.
-
[1.10+] ItemHandler Output Slots
Ah, gotcha.
-
[1.10+] ItemHandler Output Slots
Should just be able to call super.insertItem() at that point, no?
-
[1.10+] ItemHandler Output Slots
So something occurred to me recently. ItemHandlers need to be exposed for both input and output. In order to prevent an item from being inserted into an "output" slot, setting up a custom ItemHandler class to always return the item inserted into it seems to make sense. Expose for extraction, forbid insertion, seems reasonable. However. Now that means that a machine itself can't put items into its own output slot (other than by using setStackInSlot() which requires that it calculate the stack size manually). There's got to be a better way than this...what am I missing?
-
Not equal to air
While I know I can do this with Eclipse, I prefer not to for very large classes like Block because the list is very very large and often I'm already looking at the method I want to override.
-
[1.10.2][SOLVED] Getting a Block Property by property name
You can't compare strings this way. Well you can but its not going to work. http://stackoverflow.com/questions/513832/how-do-i-compare-strings-in-java
-
Not equal to air
Open up the Block class. Ctrl-F "onBlockActivated" Copy-paste
-
[1.10.2][SOLVED] Getting a Block Property by property name
This is how I handled getting the property with the name "age", along with its max and current value: Iterator<IProperty<?>> props = state.getPropertyNames().iterator(); while(props.hasNext()) { IProperty<?> p = props.next(); //lower case just to insure we're matching if(p instanceof PropertyInteger && p.getName().toLowerCase().equals("age")) { PropertyInteger ageProp = (PropertyInteger)p; //do whatever: int maxAge = (Integer) ageProp.getAllowedValues().toArray()[ageProp.getAllowedValues().size()-1]; int currAge = state.getValue(ageProp); } } And if there are any improvements, I would be interested.
-
Not equal to air
Your method signature is wrong.
-
Not equal to air
Please don't check against the air block. Many mods use "technical" blocks for various things (usually lighting), but which should be treated like air. I'd suggest checking the block's material against Material.AIR
-
[1.10] How to Entity Make Attack
EntityAIAttackMelee isn't an "attack you when you attack it" it's the "I bump into you and deal damage" behavior. You might also want to look at what makes EntityAIZombieAttack different.
-
[1.10] How to Entity Make Attack
Let me just go look at vanilla code for a second. Oh look at that. EntityAIZombieAttack extends EntityAIAttackMelee
-
MC1.10+ drops from leaves
Ahh. IBlockState blockstate = world.getBlockState(pos); Don't do this. You want event.getState() (getBlockState? I am not sure on the exact name). That will give you the block that decayed.
-
Help with setBlockState
scheduled ticks are, by definition, not random. You can use a random interval, but they are distinct from random update ticks, which are given to a fixed number of blocks in each chunk at random. Yes: Use @Override on every method that you are overriding. If Eclipse says "not valid, suggest remove" then you should fix the signature. Eclipse can't suggest an alternate signature, its too complex of an operation.
-
Help with setBlockState
There are random update ticks. Look at BlockCrops. Line 28, specifically.
-
Help with setBlockState
For random ticks, you didn't specify that your block should receive random ticks). For right-clicking, you have the wrong method signature (@Override would tell you this). You want public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, @Nullable ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ)
-
Help with setBlockState
You can simplify this: BlockPos pos0 = new BlockPos(pos.getX(), (pos.getY()+1) , pos.getZ()); BlockPos pos0 = pos.up(); That said, what isn't working correctly?
-
[Solved] [1.11] Creating Quarry
IBlockState#getValue(BlockDirectional.FACING)
-
Intellj Debug Question
Containers are instanced once and then it just renders AFAIK. Have you tried making the changes, then closing and re-opening the GUI?
-
TE throws a Null Exception during update.
Always post the crash report.
-
[1.10] CustomEntity transform automaticaly into pig? o.O
No, you do not need a spawn egg for spawners to work.
-
TE throws a Null Exception during update.
*Cough*
-
TE throws a Null Exception during update.
Null check, yes. Also sendUpdate is a void, so you don't return anything.
-
TE throws a Null Exception during update.
My first guess is that worldObj is null (which can happen).
IPS spam blocked by CleanTalk.