-
[SOLVED] [1.12.2] How to devide vanilla block with their variant
OK, I see. Thanks for your easy and gentle advises.
-
[SOLVED] [1.12.2] How to devide vanilla block with their variant
Thanks, I see. However, How can I add other 15 prismarine metadata? Are there any way to add block metadata over 16? I thisk it is not able. Do you have any idea for adding other 15 blocks in existing prismarine block? Must I add block which has 15 other metadata in my mod?
-
[SOLVED] [1.12.2] How to devide vanilla block with their variant
Thanks for your advice. I want to change not item name but registry name. Otherwise, I want to add variant as other 15 colored prismarine block. In my ideal, my mod have "prismarine block" and "prismarine bricks block" and "colored prismarine block" registry name.
-
[SOLVED] [1.12.2] How to devide vanilla block with their variant
Hi. I want to rename vanilla prismarine block. In vanilla, prismarine's metadata is 1, prismarine bricks' metadata is 2, dark prismarine's metadata is 3. I want to remove these metadata and rename them new block name such as prismarine -> "prismarine", prismarine bricks -> "prismarine_block", dark prismarine -> "dark_prismarine". Anyone help me please. I think I should override vanilla prismarine block, so I tried this code but error occoured. @ObjectHolder(Reference.MODID) public class HamaBlocks { @ObjectHolder("minecraft:prismarine") public static Block prismarine = null; @ObjectHolder("minecraft:prismarine_bricks") public static Block prismarineBricks = null; @ObjectHolder("minecraft:dark_prismarine") public static Block darkPrismarine = null; public static void onBlockRegister(RegistryEvent.Register<Block> event) { event.getRegistry().registerAll(// new Block(Material.ROCK).setCreativeTab(CreativeTabs.BUILDING_BLOCKS)// .setRegistryName(new ResourceLocation("minecraft", "prismarine"))// .setUnlocalizedName("prismarine"),// new Block(Material.ROCK).setCreativeTab(CreativeTabs.BUILDING_BLOCKS)// .setRegistryName(new ResourceLocation("minecraft", "prismarine_bricks"))// .setUnlocalizedName("prismarine_bricks"),// new Block(Material.ROCK).setCreativeTab(CreativeTabs.BUILDING_BLOCKS)// .setRegistryName(new ResourceLocation("minecraft", "dark_prismarine"))// .setUnlocalizedName("dark_prismarine")// ); } }
-
[1.12.2]aded NBT with Tile Entity is removed
Thanks for a lot of advices! I tried them and it worked well!
-
[1.12.2]aded NBT with Tile Entity is removed
Hi. I added forge 1.12.2 item which teleport any entity to specific position and block that determine the position. The data of teleportation is saved NBT of item. However, NBT data is lost. The scene is when I picked item on block's gui (without Shift). additionally, an entity does not teleport to the place set without opening the inventory at once. anyone help me ? https://github.com/nihotamor/pipocraft/tree/master/
-
[SOLVED] [1.12.2] My Tile Entity returns custom name only spectator
Sorry, I have not updated and get tile entity packet anytime. So now Tile Entity returns custom name!!
-
[SOLVED] [1.12.2] My Tile Entity returns custom name only spectator
Hi. I'm trying to create a mod includes a block has tile entity like a minecraft:chest. However, when I opened a gui of the block, it returns custom name only when I am spectator. In other gamemode, tile entity returns default name such as "container.crate" as it doesn't have custom name.I tryed vanilla source from TileEntityChest, but it didn't work. Custom name is saved correctly to NBT. Even if I change custom name by using command, it is displayed only spectator mode. package doph.gpubg.tileentity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.ItemStackHelper; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.NonNullList; import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.TextComponentString; import net.minecraft.util.text.TextComponentTranslation; public class TileEntityCrate extends TileEntity implements IInventory { private NonNullList<ItemStack> inventory = NonNullList.<ItemStack>withSize(getSizeInventory(), ItemStack.EMPTY); private String customName; public void setName(String name) { this.customName = name; } public NonNullList<ItemStack> getInventory(){ return inventory; } public void setItems(EntityPlayer player) { NonNullList<ItemStack> inv = player.inventory.mainInventory; for(int i = 0; i < 36; i++) { this.inventory.set(i, inv.get(i)); } inv = player.inventory.armorInventory; for(int i = 0; i < 4; i++) { this.inventory.set(i + 36, inv.get(i)); } inv = player.inventory.offHandInventory; this.inventory.set(40, inv.get(0)); } @Override public void readFromNBT(NBTTagCompound compound) { super.readFromNBT(compound); this.inventory = NonNullList.<ItemStack>withSize(this.getSizeInventory(), ItemStack.EMPTY); ItemStackHelper.loadAllItems(compound, this.inventory); if (compound.hasKey("CustomName", 8)) { this.customName = compound.getString("CustomName"); } } @Override public ITextComponent getDisplayName() { return (ITextComponent) (this.hasCustomName() ? new TextComponentString(this.getName()) : new TextComponentTranslation(this.getName())); } @Override public NBTTagCompound writeToNBT(NBTTagCompound compound) { super.writeToNBT(compound); ItemStackHelper.saveAllItems(compound, this.inventory); if (this.hasCustomName()) { compound.setString("CustomName", this.customName); } return compound; } @Override public int getSizeInventory() { return 45; } @Override public boolean isEmpty() { for (ItemStack itemstack : this.inventory) { if (!itemstack.isEmpty()) { return false; } } return true; } @Override public ItemStack getStackInSlot(int index) { if (index >= 0 && index < getSizeInventory()) { return this.inventory.get(index); } return ItemStack.EMPTY; } @Override public ItemStack decrStackSize(int index, int count) { return ItemStackHelper.getAndSplit(this.inventory, index, count); } @Override public ItemStack removeStackFromSlot(int index) { return ItemStackHelper.getAndRemove(inventory, index); } @Override public void setInventorySlotContents(int index, ItemStack stack) { ItemStack itemstack = getStackInSlot(index); boolean flag = !stack.isEmpty() && stack.isItemEqual(itemstack) && ItemStack.areItemStacksEqual(stack, itemstack); this.inventory.set(index, stack); if (stack.getCount() > this.getInventoryStackLimit()) { stack.setCount(this.getInventoryStackLimit()); } if (!flag) { this.markDirty(); } } @Override public int getInventoryStackLimit() { return 64; } @Override public String getName() { return this.hasCustomName() ? this.customName : "container.crate"; } @Override public boolean isUsableByPlayer(EntityPlayer player) { if (this.world.getTileEntity(this.pos) != this) { return false; } else { return player.getDistanceSq(this.pos.getX() + 0.5D, this.pos.getY() + 0.5D, this.pos.getZ() + 0.5D) <= 64.0D; } } @Override public void openInventory(EntityPlayer player) { } @Override public void closeInventory(EntityPlayer player) { } @Override public boolean isItemValidForSlot(int index, ItemStack stack) { return false; } @Override public int getField(int id) { return 0; } @Override public void setField(int id, int value) { } @Override public int getFieldCount() { return 0; } @Override public void clear() { this.inventory.clear(); } @Override public boolean hasCustomName() { return this.customName != null && !this.customName.isEmpty(); } } Does anyone have a good idea?
-
SOLVED [1.12.2] getTileEntity returns null
I addded these methods to BaseManaita which should have Tile Entity: @Override public boolean hasTileEntity(IBlockState state) { return true; } @Override public TileEntity createTileEntity(World world, IBlockState state) { return new TileEntityManaita(); } And I checked coord of BlockPos which is argument of getServerGuiEvent, it seems is not the correct block position. I didn't pass correct block position in openGui method. When I passed correct position, it worked well!
-
SOLVED [1.12.2] getTileEntity returns null
Thanks for your advice. However, The method still returns null
-
SOLVED [1.12.2] getTileEntity returns null
Hello. I created a block which has a tile entity. However, when I access to the tile entity by using getTileEntity(BlockPos), the return value is null. In spite of I create tile entity by createNewTileEntity(World, int) method, it seems tile entity does not exist. Can anyone tell why this happened? Here is my all source code. https://github.com/nihotamor/melonpan
-
[1.12.2] Issues about Model and Collision
Sorry I used github via web browser.
-
[1.12.2] Issues about Model and Collision
I mistook file name when I create file on github because I didn't know way to drag and drop file at first. I already fixed. There are not enough document about forge tutorial in Japan, so I have to study old article... Oh, I missed it! I have to add it in my code. OK, I see. Thank you for your advices. I hava to rewrite the majority of my codes, so I recreate project and restart from first. I will report and ask later.
-
[1.12.2] Issues about Model and Collision
OK, here is a my all code. https://github.com/nihotamor/cookmod
-
[1.12.2] Issues about Model and Collision
Sorry, I forgot to say that these methods is called from @SubscribeEvent public static void OnBlockRegistered(RegistryEvent.Register<Block> e); @SubscribeEvent public static void OnItemRegistered(RegistryEvent.Register<Item> e);
IPS spam blocked by CleanTalk.