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

meee39

Members
  • Posts

    119
  • Joined

  • Last visited

Everything posted by meee39

  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.
  14. I am using this code: public class ItemBlockReinforcedFruit extends ItemBlock { public String type; public ItemBlockReinforcedFruit(Block block, String type) { super(block); this.type = type; } @Override public boolean isValidArmor(ItemStack stack, EntityEquipmentSlot armorType, Entity entity) { return armorType == EntityEquipmentSlot.HEAD; } public Multimap<String, AttributeModifier> getItemAttributeModifiers(EntityEquipmentSlot equipmentSlot) { Multimap<String, AttributeModifier> multimap = super.getItemAttributeModifiers(equipmentSlot); int defence = 0; if (type == "iron") { defence = 2; } else if (type == "gold") { defence = 2; } else if (type == "diamond") { defence = 3; } if (equipmentSlot == EntityEquipmentSlot.HEAD) { multimap.put(SharedMonsterAttributes.ARMOR.getName(), new AttributeModifier("Armor modifier", defence, 0)); } return multimap; } } And as you can see here: https://youtu.be/_1OftRtLDH8 When you remove the armour, you keep the defence value so you can cheat that way.
  15. I am making a mod called Reinforced Pumpkin, which adds in a pumpkin that you can wear, and it will also provide defence. I have used a custom ItemBlock to make it able to be put in the head slot. How do I make it give the player defence?
  16. I am making a custom version of the elytra, but you will be able to craft one to the other for compatibility reasons. I want to make it impossible to equip the elytra in any way, or to make it detect the player wearing elytra and drop the item. Edit: Solved. I added a tick handler that makes the item drop from the inventory.
  17. Is there some kind of event that will allow me to detect when an ItemFrame appears during world gen so I can replace it with some other item?
  18. I am making a mod that removes being able to repair elytra with leather and making it so you repair it with "Endermite scales". How do I remove the normal repair recipe? Also, how do I add my own one in?
  19. What do you mean by that? Edit: Never mind, I figured it out
  20. Code: https://github.com/Leowbattle/Refactorization/blob/master/src/main/java/refactorization/blocks/BlockCompactor.java Blockstate: https://github.com/Leowbattle/Refactorization/blob/master/src/main/resources/assets/refactorization/blockstates/compactor.json Model Off: https://github.com/Leowbattle/Refactorization/blob/master/src/main/resources/assets/refactorization/models/block/compactor_off.json Model On: https://github.com/Leowbattle/Refactorization/blob/master/src/main/resources/assets/refactorization/models/block/compactor_on.json In setDefaultState() I set is_on to false, but when it appears in-game it is set to true (checked with F3).
×
×
  • Create New...

Important Information

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