Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

meee39

Members
  • Posts

    119
  • Joined

  • Last visited

Converted

  • Gender
    Male

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

meee39's Achievements

Creeper Killer

Creeper Killer (4/8)

0

Reputation

  1. If I do copy the generation code is it likely the mod will be taken down for plagiarism?
  2. Do I need to copy the chunk generation code but replace references to end stone etc with netherrack etc? I'm trying to recreate 1.13 buffet generation.
  3. For my mod I need a text editor in the gui, although GuiTextField only provides 1 line, and I don't really want to have to write my own one. Is there a library (or some other class in the base game or Forge that I don't know of) that provides such a gui widget?
  4. I do know how to create the file "substrate:block/hull", but only so it will make it use the same texture for all variants. How do I have one file "substrate:block/hull" that will render the block correctly in the world and be the parent of the item model?
  5. Oops! I forgot to link the GitHub repository. https://github.com/Leowbattle/Substrate
  6. I am making a simple mod that just adds a few blocks, although I can't figure out how to make a block with metadata render with the correct texture. In the blockstate, I can put ""textures:" {"all": "x:y/z"}", but that makes it use texture z for every blockstate. The block extends BlockColored too, if that helps.
  7. No. How do I do that? EDIT: I've done that in 1.11.2. I think I'll be able to figure it out
  8. Also whenever you eat with it or reenter the world, the hunger is set back to 10 and the saturation to 20.
  9. The NBT values are set by a slider in the Gui. The maximum value for both is 20. I think that is fine for hunger, but not saturation.
  10. I am making an Electronic Lunchbox mod that uses RF to feed you. I have this code: package electroniclunchbox.items; import java.util.List; import org.lwjgl.input.Keyboard; import cofh.redstoneflux.api.IEnergyContainerItem; import electroniclunchbox.ElectronicLunchbox; import electroniclunchbox.gui.ModGuiHandler; import net.minecraft.advancements.CriteriaTriggers; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.init.SoundEvents; import net.minecraft.item.ItemFood; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.potion.PotionEffect; import net.minecraft.stats.StatList; import net.minecraft.util.ActionResult; import net.minecraft.util.EnumHand; import net.minecraft.util.SoundCategory; import net.minecraft.world.World; public class ItemElectronicLunchbox extends ItemFood implements IEnergyContainerItem { public static final int capacity = 1000000; public static final int maxReceive = 10000; public ItemElectronicLunchbox(int amount, float saturation, boolean isWolfFood) { super(amount, saturation, isWolfFood); } @Override public ItemStack onItemUseFinish(ItemStack stack, World worldIn, EntityLivingBase entityLiving) { if (entityLiving instanceof EntityPlayer) { EntityPlayer entityplayer = (EntityPlayer)entityLiving; entityplayer.getFoodStats().addStats(this, stack); worldIn.playSound((EntityPlayer)null, entityplayer.posX, entityplayer.posY, entityplayer.posZ, SoundEvents.ENTITY_PLAYER_BURP, SoundCategory.PLAYERS, 0.5F, worldIn.rand.nextFloat() * 0.1F + 0.9F); this.onFoodEaten(stack, worldIn, entityplayer); entityplayer.addStat(StatList.getObjectUseStats(this)); if (entityplayer instanceof EntityPlayerMP) { CriteriaTriggers.CONSUME_ITEM.trigger((EntityPlayerMP)entityplayer, stack); } } return stack; } @Override public int getMaxItemUseDuration(ItemStack stack) { return super.getMaxItemUseDuration(stack); } @Override public int getHealAmount(ItemStack stack) { NBTTagCompound nbt = stack.getTagCompound(); return nbt.getInteger("Hunger"); } @Override public float getSaturationModifier(ItemStack stack) { NBTTagCompound nbt = stack.getTagCompound(); return nbt.getInteger("Saturation"); } @Override public boolean isWolfsFavoriteMeat() { return super.isWolfsFavoriteMeat(); } @Override public ItemFood setPotionEffect(PotionEffect effect, float probability) { return super.setPotionEffect(effect, probability); } @Override public ItemFood setAlwaysEdible() { return super.setAlwaysEdible(); } @Override public void addInformation(ItemStack stack, World worldIn, List<String> tooltip, ITooltipFlag flagIn) { super.addInformation(stack, worldIn, tooltip, flagIn); if (!stack.hasTagCompound()) { return; } NBTTagCompound nbt = stack.getTagCompound(); tooltip.add("Shift-Right Click Me To Edit My Settings"); tooltip.add("Hunger: " + nbt.getInteger("Hunger")); tooltip.add("Saturation: " + nbt.getInteger("Saturation")); tooltip.add("RF Cost: "); } @Override public double getDurabilityForDisplay(ItemStack stack) { if (!stack.hasTagCompound()) { NBTTagCompound nbt = new NBTTagCompound(); nbt.setInteger("Energy", 0); nbt.setInteger("Hunger", 0); nbt.setInteger("Saturation", 0); stack.setTagCompound(nbt); } NBTTagCompound nbt = stack.getTagCompound(); return (double)capacity / (double)nbt.getInteger("Energy"); } @Override public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn) { if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { playerIn.openGui(ElectronicLunchbox.instance, ModGuiHandler.electronicLunchboxGuiID, worldIn, (int)playerIn.posX, (int)playerIn.posY, (int)playerIn.posZ); } return super.onItemRightClick(worldIn, playerIn, handIn); } @Override public boolean showDurabilityBar(ItemStack stack) { return true; } @Override public int extractEnergy(ItemStack arg0, int arg1, boolean arg2) { return arg1; } @Override public int getEnergyStored(ItemStack arg0) { return 0; } @Override public int getMaxEnergyStored(ItemStack arg0) { return 1000000; } @Override public int receiveEnergy(ItemStack arg0, int arg1, boolean arg2) { if (!arg0.hasTagCompound()) { arg0.setTagCompound(new NBTTagCompound()); } int energy = arg0.getTagCompound().getInteger("Energy"); int energyReceived = Math.min(capacity - energy, Math.min(maxReceive, maxReceive)); if (!arg2) { energy += energyReceived; arg0.getTagCompound().setInteger("Energy", energy); } return energyReceived; } } The NBT on it is set in a Gui, but that works perfectly. The problem is that no matter what the NBT says the hunger and saturation will heal, it will heal the whole hunger bar full of hunger and saturation.
  11. Well, what method is the one I should be using?
  12. Okay. I used UUID.random() to get a UUID for the block and now it gets applied and taken away properly. SOLVED
  13. That was the one you said to use though, and I copied the method signature from ItemArmor.java.
×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.