
RealTheUnderTaker11
Members-
Posts
66 -
Joined
-
Last visited
Everything posted by RealTheUnderTaker11
-
[1.12]How to make recipes configurable?
RealTheUnderTaker11 replied to RealTheUnderTaker11's topic in Modder Support
Sorry to take so long to reply (been pretty busy), but all that seems like more trouble than it's worth, and I found this handy helper class that lets me register them almost exactly as I was. I might change it later but for right now it doesn't seem worth it. -
I have a magnet mod that has a Boolean in the config to change the recipes for every magnet in the mod (so there can be easy mode recipes or normal recipes). Before 1.12, this was easy. How would I now be able to give the player a config option to change the recipes of each item? Sorry if this has been asked or explained before, it's hard to find good information on this new JSON recipe system.
-
TileEntity Issue with rendering|| 1.11.2
RealTheUnderTaker11 replied to Jigokusaru's topic in Modder Support
I don't know why you would want to extend it, but by default BlockContainer has this method. public EnumBlockRenderType getRenderType(IBlockState state) { return EnumBlockRenderType.INVISIBLE; } Which does just about what it looks like. Just override that. -
TileEntity Issue with rendering|| 1.11.2
RealTheUnderTaker11 replied to Jigokusaru's topic in Modder Support
I had this problem as well first time I tried, just don't extend block container. You don't say what version you are on, but you can either implement ITileEntityProvider or in your constructor set isBlockContainer to true, then override the createTileEntity() and hasTileEntity() methods in your block class. -
The three classes directly relating to the block ModelBlockBase I have a pedestal I am using to render whatever item is stored inside of it, and it works fine when I right click the block and put the item in. But as soon as I exit the world and come back, it won't render until I pull the item out and put it back in again. I traced it to the fact that the TESR thinks the ItemStack is null until I pull it out and put it back in manually. (The isItemStackEmpty() is just my own method that does a null check to make updating to 1.11 easier.) I have tried getting the capability from the tile entity which didn't help.Then I tried using the onLoad() method to remove and put back in the ItemStack inside, but that only crashed the game. Lastly I tried using the update() method to do the same thing as the onLoad(), and that did nothing at all. What can I change to make it so they TESR/client doesn't think the pedestal is empty every time the world loads?
-
So I'm trying to make a furnace, and I got everything set up but I'm having one problem, when I try and smelt items, I put some cobblestone/raw porkchop in and the smelting result is 1 item, 4 items, 16 items, 32 items, then 64 items. (Instead of 1 item, 2 items, 3 items, 4 items, etc. as it should be.) So that makes it when you put 5 items in it smelts them all into a stack of whatever the result is. Another problem is a lot of times if I try and pull it out before it is a full stack, the items will disappear. Last problem is after it smelts the first stack(Or I pull items out early) it won't put ANY more items into the result slot, it just uses up the input without putting anything into the output. Now I have narrowed it down to this one function I have. public static ItemStack getSmeltingResultForItem(ItemStack stack) { else return FurnaceRecipes.instance().getSmeltingResult(stack); } That is returning the crazy doubling numbers I'm seeing. Even more so, when I replace the above code with this. public static ItemStack getSmeltingResultForItem(ItemStack stack) { if(stack.getItem()==Item.getItemFromBlock(Blocks.COBBLESTONE)) { return new ItemStack(Item.getItemFromBlock(Blocks.STONE), 1); } else return FurnaceRecipes.instance().getSmeltingResult(stack); } It works perfect for cobblestone, but then has the same problem with raw pork-chop or anything else I put in. For a better view of my code I will put all related classes in KSTileEntityBlessedFurnace TileEntityContainerBase ContainerBlessedFurnace BlockBlessedFurnace I wouldn't think you would need all this code to figure out the problem, but just in case I put it all there. (It also has a gui I just didn't put that here)
-
1.10.2 Item with IItemHandler capability
RealTheUnderTaker11 replied to Denyol's topic in Modder Support
Then you should of asked that in the first place, I used this to make a capability handler for players/Entity's. It should be something very similar for ItemStacks. I don't know how it will work for ItemHandlers though since those are already a thing in forge EDIT: Yea what Draco said too.- 10 replies
-
- capability
- iitemhandler
-
(and 1 more)
Tagged with:
-
1.10.2 Item with IItemHandler capability
RealTheUnderTaker11 replied to Denyol's topic in Modder Support
The ItemStack is what has the hasCapability, and I have never set up an item that holds inventory, but since they don't have sides I wouldn't think you would need to override the hasCapability and getCapability. Have you tried setting up the capability handler and seeing what happens? Like I said I've never tested it before though. I could be completely wrong about this.- 10 replies
-
- capability
- iitemhandler
-
(and 1 more)
Tagged with:
-
resolved Trouble with @Optional.Interface
RealTheUnderTaker11 replied to RealTheUnderTaker11's topic in Modder Support
Oh my god I'm going to set this as resolved, I just figured out the 1.10.2 mod ID of baubles is actually Baubles... -
resolved Trouble with @Optional.Interface
RealTheUnderTaker11 replied to RealTheUnderTaker11's topic in Modder Support
To early for a bump? Along with saying I tested putting blahblah in the iface and it loaded the as a Bauble, so I feel like it somehow thinks baubles isn't there and removes the interface. (When I do the iface without the .class like it should be) -
resolved Trouble with @Optional.Interface
RealTheUnderTaker11 replied to RealTheUnderTaker11's topic in Modder Support
I did that and it didn't change any of the circumstances. (AKA without the .class it doesn't load as a bauble at all, with the .class and @Optional.Method it crashes when I mouse over it, and with the .class but without Optional.Method it runs as a bauble without a crash. I'm about to compile it and test without Baubles but I bet it will be the same class missing error) EDIT: I can confirm it still crashed with this error when run without baubles. Caused by: java.lang.NoClassDefFoundError: com/theundertaker11/kitchensink/ksitems/blessedRock -
resolved Trouble with @Optional.Interface
RealTheUnderTaker11 replied to RealTheUnderTaker11's topic in Modder Support
Original crash log in spoiler and shadowfacts, don't worry, every step of the way I will do it without the .class, I was just explaining the situation to you -
resolved Trouble with @Optional.Interface
RealTheUnderTaker11 replied to RealTheUnderTaker11's topic in Modder Support
Like I said before it doesn't work if I do that though. I'll give you 2 screenshots that go with 2 sets of code to give you an idea of what is happening. This is WITH the baubles mod running. First set, without the .class. Notice it also has the Optional.Method Second set, with the .class, as said before I had to comment out the Optional.Method due to it causing a crash. And yes, for both I tried to put them into my baubles inventory, and only the one with the tooltip worked. Why would it not load at all if I don't have the .class there? -
resolved Trouble with @Optional.Interface
RealTheUnderTaker11 replied to RealTheUnderTaker11's topic in Modder Support
Now my @Mod looks like this- @Mod(modid = Refernce.MODID, version = Refernce.VERSION, name = Refernce.NAME, dependencies="after:baubles;") but it still crashes if I try and use the @Optional.Method, same report as before. Also tried removing the @Optional.method, then compiling and running without baubles, crashed.(Same report as original crash) EDIT:Leaving now so it will be a bit before I reply to this one, 2 hours probably. -
resolved Trouble with @Optional.Interface
RealTheUnderTaker11 replied to RealTheUnderTaker11's topic in Modder Support
No I hadn't seen anything about that in my searches on adding Optional interfaces and methods, how would I do that? -
resolved Trouble with @Optional.Interface
RealTheUnderTaker11 replied to RealTheUnderTaker11's topic in Modder Support
As I stated above the code, I had already done that and it has to be "baubles.api.IBauble.class", it didn't work at all unless I had the .class there. Even with baubles installed. I tested it again just now and I can confirm it won't work at all (as a bauble) without the .class.(By that I mean it works fine as an item with no errors or crashes, but just doesn't work as a bauble.) Everywhere I read said it removed all related methods if it removed the interface. Regardless when I use the code below it crashes my game with the attached crash report(when I mouse the item in my inventory), but when I removed the @Optional.Method() it doesn't crash. Also read what I replied to diesieben07 above. import java.util.List; import com.theundertaker11.kitchensink.KitchenSink; import com.theundertaker11.kitchensink.event.WorldTick; import baubles.api.BaubleType; import baubles.api.IBauble; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World; import net.minecraftforge.fml.common.Optional; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @Optional.Interface(iface="baubles.api.IBauble.class",modid="baubles") public class blessedRock extends ItemBase implements IBauble{ public blessedRock(String name){ super(name, true); this.setMaxStackSize(1); } @Override @SideOnly(Side.CLIENT) public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced) { tooltip.add("What could a rock ever... Oh!"); } @Override public EnumRarity getRarity(ItemStack stack) { return EnumRarity.RARE; } @Override public void onUpdate(ItemStack itemstack, World world, Entity entity, int metadata, boolean bool) { if(entity instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer)entity; String username = player.getGameProfile().getName(); if(!WorldTick.PlayersWithFlight.contains(username)) WorldTick.PlayersWithFlight.add(username); player.capabilities.allowFlying = true; } } @Optional.Method(modid="baubles") @Override public BaubleType getBaubleType(ItemStack arg0) { return BaubleType.TRINKET; } } crash-2017-02-03_18.05.29-client.txt -
FIX: So there was three problems, one was the mod ID for baubles is actually Baubles, and 2 is I needed to removed the .class. The third is I needed an @Optional.Method above the method. Hope this helps anyone who finds it! So I'm trying to figure out how to use the @Optional annotation and it is not going well. The class code is below. On the line that says @Optional.Interface(iface="IBauble",modid="baubles") I have also tried @Optional.Interface(iface="baubles.api.IBauble.class",modid="baubles") and got the same crash.(The crash report is a classNotFound blah blah error, file attached.) import java.util.List; import com.theundertaker11.kitchensink.KitchenSink; import com.theundertaker11.kitchensink.event.WorldTick; import baubles.api.BaubleType; import baubles.api.IBauble; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World; import net.minecraftforge.fml.common.Optional; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @Optional.Interface(iface="IBauble",modid="baubles") public class blessedRock extends ItemBase implements IBauble{ public blessedRock(String name){ super(name, true); this.setMaxStackSize(1); } @Override @SideOnly(Side.CLIENT) public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced) { tooltip.add("What could a rock ever... Oh!"); } @Override public EnumRarity getRarity(ItemStack stack) { return EnumRarity.RARE; } @Override public void onUpdate(ItemStack itemstack, World world, Entity entity, int metadata, boolean bool) { if(entity instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer)entity; String username = player.getGameProfile().getName(); if(!WorldTick.PlayersWithFlight.contains(username)) WorldTick.PlayersWithFlight.add(username); player.capabilities.allowFlying = true; } } @Override public BaubleType getBaubleType(ItemStack arg0) { return BaubleType.TRINKET; } } crash-2017-02-03_17.09.11-client.txt
-
I want to make a tile entity that can only input/output on certain sides, but any time I use the EnumFacing's it does the facing in relation to the world. I'm not sure how to get say the "right side" of a block I place, and the capability that goes with it. A lot of this probably comes from the fact I don't fully understand how the code that makes the block place facing the player works in the first place. If anyone could explain these things or link me somewhere that does it would be greatly appreciated. This is the code I have that makes it place facing the player. If you guys could hint how I make this only do horizontal that would also be helpful. I haven't worked with vectors or anything like that so I'm not sure how any of that works. public class StorageBlockBase extends BlockBase{ public static final PropertyDirection FACING = PropertyDirection.create("facing"); public StorageBlockBase(String name, Material material, float hardness, float resistance) { super(name, material, hardness, resistance); this.isBlockContainer=true; setDefaultState(blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH)); } public StorageBlockBase(String name) { this(name, Material.IRON, 0.5f, 0.5f); } @Override public boolean hasTileEntity(IBlockState state) { return true; } //This should be overridden in every actual block code. @Override public TileEntity createTileEntity(World world, IBlockState state) { return null; } /////////BEGIN CODE TO MAKE IT FACE TOWARDS THE PLAYER WHEN PLACED///////// @Override public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) { world.setBlockState(pos, state.withProperty(FACING, getFacingFromEntity(pos, placer)), 2); } public static EnumFacing getFacingFromEntity(BlockPos clickedBlock, EntityLivingBase entity) { return EnumFacing.getFacingFromVector( (float) (entity.posX - clickedBlock.getX()), 0,//(float) (entity.posY - clickedBlock.getY()), (float) (entity.posZ - clickedBlock.getZ())); } @Override public IBlockState getStateFromMeta(int meta) { return getDefaultState().withProperty(FACING, EnumFacing.getFront(meta & 7)); } @Override public int getMetaFromState(IBlockState state) { return state.getValue(FACING).getIndex(); } @Override protected BlockStateContainer createBlockState() { return new BlockStateContainer(this, FACING); } /////////END CODE TO MAKE IT FACE TOWARDS THE PLAYER WHEN PLACED///////// }