Skip to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

ChampionAsh5357

Members
  • Joined

  • Last visited

Everything posted by ChampionAsh5357

  1. After further research, it seems as there 4 3 main problems excluding the banner nbt one. 1. The piston if mined when extended at the head will drop the block and the uncrafted recipe. 2. The bed drops the block instead of the recipe. 3. The shulker box drops the block with the items still inside instead of the recipe. 4. There seems to be some sort of item duplication that increases over each block mined with recipes having more than one of the same block. The first three seem to originate from Block#dropBlockAsItemWithChance while I can't seem to find the cause of the fourth problem.
  2. The issue is here that getRecipeOutput() will work for and Shaped or Shapeless recipe defined in the json files since they all have getRecipeOutput() as the main output. Anything pertaining to banners would not work with the current setup due to patterns. That would require complete markings of all banner inputs with IRecipe which I don't believe is possible without freezing or lagging out the game. If we were to ignore those custom IRecipes, that would just make it impossible to uncraft anything customly defined. However, this still leaves the question of multiblock structures being mined. The bed, for example, should output its contents but instead returns the block itself.
  3. Entities are registered through the EntityEntry registry event. This can be accessed using EntityEntryBuilder#create and finished with EntityEntryBuilder#build to get the EntityEntry. There are a number of optional and required parameters such as EntityEntryBuilder#spawn or EntityEntryBuilder#id respectively that can be chained before ending with EntityEntryBuilder#build. Spawners are set using MobSpawnerBaseLogic#setEntityId like the one used in your example. However, you need the resourcelocation such as "skeleton" or "modid:entityid" if you are not using a Minecraft entity. You can set the id of your entity by chaining EntityEntryBuilder#id to the created instance.
  4. That would make sense, I'm assuming that the RayTraceResult can just be gathered by the position of the block and a insignificant EnumFacing. Can that be obtained by going through getIngredients()? Otherwise, I do not know how to get an instance of InventoryCrafting for the IRecipe. Switching to ItemStack#areItemStacksEqual then. The line referred to is "ItemStack ing = ingredient.getMatchingStacks()[(new Random()).nextInt(ingredient.getMatchingStacks().length)];" I misread the error. Apologies. Fixed the issue. Here is the rearranged code (getRecipeOutput not changed yet as for lack of knowledge of how to):
  5. I've recently taken the task of trying to create an uncrafting enchantment where a block is mined and then disassembles itself according to its crafting recipe. I've created the code that allows this to work, however, there are a few problems I can't seem to figure out. First, the items outputted don't always come out in the correct amounts. For example, mining a diamond block outputs three stacks instead of just nine diamonds. This occurs semi-randomly based on the number of items. Second, some blocks when broken throw an ArrayOutOfBoundsException such as the chest when breaking. I'm not sure how this is possible as the index pulled out of the getMatchingStacks is only as large as the size of the array. If you could provide a solution to either problem, it would be greatly appreciated. Here's the code:
  6. Currently, I am working on creating custom particles for 1.13.2. However, the public static final value of the particle type seems to throw null each time rather than getting the value. When I try adding an ObjectHolder annotation, the game says it cannot get the registry (which in my opinion is very confusing since Particles.class has a ObjectHolder annotation). If anyone could help, it would be much appreciated. Particle: Extension of BasicParticleType: ParticleType: ParticleManager: Particles: Main (Common and Client setup):
  7. My understanding of a registry is a database used to hold information about a specific object. That would make sense why recipes were removed in 1.13.2 and tile entities were added as a registry. It does make adding an object to the game much easier. I also understand that in the case of capabilities, since it isn't a implementation of registry, it is not one. However, the CriteriaTriggers.class is seems to be the exact same in implementation of the TileEntityType.class missing the ForgeRegistryEntry. Could you not technically create a registry by using a similar implementation to that of the tile entity?
  8. Hello. I understand that registry events are the recommended way to register things in Minecraft Forge nowadays. However, if that is the case, shouldn't all registries be converted to RegistryEvents? Why are only blocks, items, potions, biomes, sounds, potions, enchantments, recipes, villager professions, and entities supported at the moment? Capabilities and KeyBindings have been around for a few versions yet they do not have their own registry event. You could even include StatBase and Criterions in this list as well. To me, it seems odd not to have a major function of Minecraft still using an outdated system compared to villager professions.
  9. Hello. I've created a sort of slot/lottery machine in which I am working on getting the animations working. However, the only animation that seems to work is the lever. The other ones for the spinners that line up and the button that you push does not seem to do the animation. Any help is appreciated. Tile Entity Renderer (The few ones commented out were for testing purposes) Model
  10. I recently started using nbt data to hold item variants. However, when using ModelLoader.setCustomMeshDefinition and ModelBakery.registerItemVariants, the textures do not render whatsoever. The text that says "modid:location#inventory" does not appear on the not rendered item either. Any help is much appreciated. Render register class: package com.championash5357.tabletop.event; import com.championash5357.tabletop.client.Namespace; import com.championash5357.tabletop.init.Items; import com.championash5357.tabletop.init.Items.ItemRegistration; import com.championash5357.tabletop.registry.CardType; import com.championash5357.tabletop.util.CardUtil; import net.minecraft.client.renderer.ItemMeshDefinition; import net.minecraft.client.renderer.block.model.ModelBakery; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.NonNullList; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.event.ModelBakeEvent; import net.minecraftforge.client.event.ModelRegistryEvent; import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.registry.GameRegistry; @Mod.EventBusSubscriber(modid = Namespace.ID) public class Events { @SubscribeEvent public static void registerModels(final ModelRegistryEvent event) { final NonNullList<Item> items = NonNullList.<Item>create(); items.addAll(ItemRegistration.ITEMS); for(Item item : items) ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(item.getRegistryName(), "inventory")); ModelLoader.setCustomMeshDefinition(Items.CARD, new ItemMeshDefinition() { @Override public ModelResourceLocation getModelLocation(ItemStack stack) { String name = CardUtil.getRegistryNameFromNBT(stack); return new ModelResourceLocation(stack.getItem().getRegistryName() + "_" + name.split("\\.")[1], "inventory"); } }); } @SubscribeEvent public static void registerVariants(final ModelBakeEvent event) { for(CardType card : GameRegistry.findRegistry(CardType.class).getValuesCollection()) ModelBakery.registerItemVariants(Items.CARD, new ResourceLocation(Namespace.ID, "card_" + card.getRegistryName().getResourcePath().split("\\.")[1])); } }
  11. The player was returning null because I called it in the beginning of the message. The player might not have been loaded yet so it couldn't set it. I moved the EntityPlayerSP inside the addScheduledTask and now everything works. Thank you for taking the time to help me do this.
  12. It's not a crash, the packet just throws an exception; the game still runs because the only thing it does it try and load the slot. If it fails then it's just air until I load it via opening the custom inventory. The line it is referring to, since I didn't post the entire packet class, is the line where I set the ItemStack in the slot.
  13. I realized that after posting it. So I tried with the EntityJoinWorldEvent and I check if the entity joined is the player. I got the server information and tried to sync it with the client. However, it only works one time on login and then the packet throws a NullPointerException somehow when I add the scheduled task. I also tried with PlayerEvent.PlayerLoggedInEvent with the same issue. Packet Event Inventory Sync Method
  14. Okay, I created everything so that it works properly. The only problem I have left is that when I first load up the world, the data in the slot does not get loaded until I open up the tab with it. Since I created a KeyBinding to change the item with what the player has in hand, the data from the slot has to be loaded by the time the entity joins the world.
  15. I tried using getSlotTexture to create a back image for the slot similar to the offhand slot and it comes up with a null texture even though the texture is defined at the place I set it to. Also, when I try to give the player an item, it only detects that once the extended inventory has been opened. Extended Inventory Container Gui Extended Inventory Updated Player Inventory (I know I'm reusing the recipe book texture on the button but its only until I can manage to get it working) Extended Inventory Slot
  16. So, just to make sure I understand everything correctly. Use an instance of ItemStackHandler to attach to the player to hold the inventory information. Then when creating the container and gui use that same instance to store the custom slots added to the player. Then to call that instance from the gui handler I would just use player.getCapability(<? extends ItemStackHandler>, null); for calling it?
  17. Ok. I think I'm going to rewrite everything so that it takes out the IInventory use and just add it on as a tab instead of just putting it off. That way it should get everything working properly and stick with the conventions. Do I need to create a class extended from ItemStackHandler then, or can I just call IItemHandler? I think I only need to store the slot I'm adding if the player inventory does it manually. I was reading the documentation of the deprecated IEntityExtenedProperties to see if that could potentially work with what I had before.
  18. I did read the forge documentation. Understanding it, maybe. From my understanding, I do not see why I can't create the inventory with an implementation of ICapabilitySerializable (which is what I did originally) and then just attach the capability via that to the player. As far as I know through NBT checking, the player inventory does save on the server side and I can see it. The problem I actually have is with loading it to the client which is actually what I didn't do when I made this thread. However, I do not really know what event or tick handler I should notify to sync the data already stored in the NBT to the client. I tried a couple of ways using EntityJoinWorldEvent and PlayerEvent.StartTracking, but I could not manage to get them to work. So that would actually be the actual issue I'm having as of this moment. I will repost my inventory and network handler along with the event class. If you have any recommendation on how I would do that, I would be interested to hear. Custom Inventory Packet Handler Event Class Apologies for the late reply.
  19. Updated writeToNBT and readToNBT in the InventoryPlayer extended class: Event Registering: Crash Report: The rest of the code remained exactly the same. The mod crashes when the player saves its NBT data at any time.
  20. Ah, that might help. For some reason I thought that attaching it to the inventory meant that it was going to be attached to the player. I've fixed that now. However, now I seem to be getting a NullPointerException when the writeToNBT function is being called. I did, and I know I need to sync the server to the client data. However, I want to get rid of all the errors first so that it at least saves to server before I start implementing the client syncing. I was going to do that as soon as I finished getting it working properly.
  21. I am trying to add a custom slot to the player inventory. I've managed to get the container and GUI working and getting the visual to show up in game. However, I cannot seem to manage to keep the inventory persistent between sessions. I've been playing with the code in multiple ways, but I cannot seem to find a working solution. I might be overlooking something major and just not be noticing it. Any help is appreciated. Custom Player Inventory Capability: Capability Registry Custom Player Inventory Event Loading Container
  22. This is my tile entity class. I'm pretty sure it synchronizing with the client because debug I ran has both values as the same during the read and write. Also, as I mentioned previously, the particles do change color which I can only assume is from the client. The only thing that doesn't change color is the actual block. I apologize if I'm misunderstanding what you meant. public class TileEntitySingleColor extends TileEntity implements ITickable{ private int red = 0, green = 0, blue = 0; @Override public NBTTagCompound writeToNBT(NBTTagCompound compound) { super.writeToNBT(compound); compound.setInteger("red", this.red); compound.setInteger("green", this.green); compound.setInteger("blue", this.blue); return compound; } @Override public void readFromNBT(NBTTagCompound compound) { super.readFromNBT(compound); this.red = compound.getInteger("red"); this.green = compound.getInteger("green"); this.blue = compound.getInteger("blue"); } @Override public NBTTagCompound getUpdateTag() { return this.writeToNBT(new NBTTagCompound()); } @Override public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity pkt) { this.readFromNBT(pkt.getNbtCompound()); } @Override public SPacketUpdateTileEntity getUpdatePacket() { return new SPacketUpdateTileEntity(this.pos, 0, this.getUpdateTag()); } public void setRgb(int red, int green, int blue) { this.red = red; this.green = green; this.blue = blue; } public int[] rgb() { return new int[] {this.red, this.green, this.blue}; } public int hex() { return ((red&0x0ff)<<16)|((green&0x0ff)<<8)|(blue&0x0ff); } @Override public void update() { } }
  23. I created a block to update the color based on the rgb input of the player. I've managed to create the tile entity and implement the IBlockColor and IItemColor for the block. However, the in-game block model doesn't update. I know that the code is working somewhat because the block's particles change color. Color Handler within postInit: Minecraft.getMinecraft().getBlockColors().registerBlockColorHandler(new IBlockColor() { @Override public int colorMultiplier(IBlockState state, IBlockAccess worldIn, BlockPos pos, int tintIndex) { TileEntitySingleColor te = (TileEntitySingleColor)worldIn.getTileEntity(pos); return te.hex(); } }, CustomBlocks.single_color); final IItemColor item_color = (stack, tintIndex) -> { IBlockState iblockstate = ((ItemBlock) stack.getItem()).getBlock().getDefaultState(); return Minecraft.getMinecraft().getBlockColors().colorMultiplier(iblockstate, null, null, tintIndex); }; Minecraft.getMinecraft().getItemColors().registerItemColorHandler(item_color, CustomBlocks.single_color); Simplified version of onBlockActivated (Test purposes): @Override public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing heldItem, float side, float hitX, float hitY) { TileEntitySingleColor color = (TileEntitySingleColor)worldIn.getTileEntity(pos); color.setRgb(255, 0, 0); color.getWorld().notifyBlockUpdate(pos, state, state, 0); return true; } Can anyone please help me figure out what I'm doing incorrectly? Thank you.
  24. The reason I use ITileEntityProvider is because I'm overriding a custom class for blocks. ITileEntityProvider does the same as extending BlockContainer. Thanks, I'll look into it.
  25. I started working on a project about a year ago now that I just started to actually complete. I spent about four hours creating the tile entity to create a pipe that teleports you to a location based on the information stored. However, when I close the world and reload it, the client side does not seem to be able to load up the information stored in the nbt while the server side can. I'm not the greatest at tile entities so I was wondering if anyone could help me fix this problem. This is my tile entity: package com.championash5357.supermariobrothers.tileentity; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; public class TileEntityWarpPipe extends TileEntity { private double xCoord, yCoord, zCoord; @Override public void readFromNBT(NBTTagCompound compound) { super.readFromNBT(compound); this.xCoord = compound.getDouble("XCoordinate"); this.yCoord = compound.getDouble("YCoordinate"); this.zCoord = compound.getDouble("ZCoordinate"); System.out.println("NBT X: "+ compound.getInteger("XCoordinate")); System.out.println("NBT Y: "+ compound.getInteger("YCoordinate")); System.out.println("NBT Z: "+ compound.getInteger("ZCoordinate")); } @Override public NBTTagCompound writeToNBT(NBTTagCompound compound) { super.writeToNBT(compound); compound.setDouble("XCoordinate", this.xCoord); compound.setDouble("YCoordinate", this.yCoord); compound.setDouble("ZCoordinate", this.zCoord); return compound; } public void setCoordinates(ItemStack wrench) { NBTTagCompound nbt = (NBTTagCompound)wrench.getTagCompound().getTag("coordinates"); this.xCoord = nbt.getDouble("XCoord"); this.yCoord = nbt.getDouble("YCoord"); this.zCoord = nbt.getDouble("ZCoord"); } public double getX() { return this.xCoord; } public double getY() { return this.yCoord; } public double getZ() { return this.zCoord; } } This is my block code: package com.championash5357.supermariobrothers.blocks; import java.util.List; import org.lwjgl.input.Keyboard; import com.championash5357.supermariobrothers.client.Reference.SuperMario; import com.championash5357.supermariobrothers.init.MarioBlocks; import com.championash5357.supermariobrothers.items.ItemWrench; import com.championash5357.supermariobrothers.tileentity.TileEntityWarpPipe; import net.minecraft.block.BlockHorizontal; import net.minecraft.block.ITileEntityProvider; import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyDirection; import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; import net.minecraft.util.Mirror; import net.minecraft.util.Rotation; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.text.TextComponentString; import net.minecraft.util.text.TextFormatting; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; public class BlockWarpPipeBase extends BlockSuperMarioBros implements ITileEntityProvider{ protected static final AxisAlignedBB PIPE_NF = new AxisAlignedBB(0.8125D, 0D, 0D, 0.875D, 1D, 0.8125D); protected static final AxisAlignedBB PIPE_NR = new AxisAlignedBB(0D, 0D, 0.8125D, 0.8125D, 1D, 0.875D); protected static final AxisAlignedBB PIPE_ND = new AxisAlignedBB(0D, 0D, 0D, 0.8125D, 0.0625D, 0.8125D); protected static final AxisAlignedBB PIPE_WF = new AxisAlignedBB(0.8125D, 0D, 0.1875D, 0.875D, 1D, 1D); protected static final AxisAlignedBB PIPE_WL = new AxisAlignedBB(0D, 0D, 0.125D, 0.8125D, 1D, 0.1875D); protected static final AxisAlignedBB PIPE_WD = new AxisAlignedBB(0D, 0D, 0.1875D, 0.8125D, 0.0625D, 1D); protected static final AxisAlignedBB PIPE_SB = new AxisAlignedBB(0.125D, 0D, 0.1875D, 0.1875D, 1D, 1D); protected static final AxisAlignedBB PIPE_SL = new AxisAlignedBB(0.1875D, 0D, 0.125D, 1D, 1D, 0.1875D); protected static final AxisAlignedBB PIPE_SD = new AxisAlignedBB(0.1875D, 0D, 0.1875D, 1D, 0.0625D, 1D); protected static final AxisAlignedBB PIPE_EB = new AxisAlignedBB(0.125D, 0D, 0D, 0.1875D, 1D, 0.8125D); protected static final AxisAlignedBB PIPE_ER = new AxisAlignedBB(0.1875D, 0D, 0.8125D, 1D, 1D, 0.875D); protected static final AxisAlignedBB PIPE_ED = new AxisAlignedBB(0.1875D, 0D, 0D, 1D, 0.0625D, 0.8125D); public static final PropertyDirection FACING = BlockHorizontal.FACING; public BlockWarpPipeBase() { super(Material.ROCK); setUnlocalizedName(SuperMario.WARP_PIPE_BASE.getUnlocalizedName()); setRegistryName(SuperMario.WARP_PIPE_BASE.getRegistryName()); setWikiName(SuperMario.WARP_PIPE_BASE.getWikiName()); this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH)); } @Override public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { ItemStack stack = playerIn.getHeldItem(hand); if(stack != null) { if(stack.getItem() instanceof ItemWrench) { if(stack.getItem().hasEffect(stack)) { TileEntityWarpPipe pipe = (TileEntityWarpPipe)worldIn.getTileEntity(pos); pipe.setCoordinates(stack); NBTTagCompound nbt = (NBTTagCompound)stack.getTagCompound().getTag("coordinates"); double x = nbt.getDouble("XCoord"); double y = nbt.getDouble("YCoord"); double z = nbt.getDouble("ZCoord"); stack.func_190918_g(1); if(!worldIn.isRemote) playerIn.addChatMessage(new TextComponentString("This warp pipe at " + TextFormatting.GOLD + pos.getX() + ", " + pos.getY() + ", " + pos.getZ() + TextFormatting.WHITE + " will now teleport the player to " + TextFormatting.GOLD + x + ", " + y + ", " + z + TextFormatting.WHITE + ".")); } } } return true; } @Override public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, IBlockAccess worldIn, BlockPos pos) { return FULL_BLOCK_AABB.offset(pos); } @Override public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn) { if(entityIn instanceof EntityPlayer) teleport((EntityPlayer)entityIn, pos, worldIn); super.onEntityCollidedWithBlock(worldIn, pos, state, entityIn); } private void teleport(EntityPlayer player, BlockPos pos, World world) { TileEntityWarpPipe pipe = (TileEntityWarpPipe)world.getTileEntity(pos); if(player.isSneaking()) { player.setLocationAndAngles(pipe.getX(), pipe.getY(), pipe.getZ(), player.rotationYaw, player.rotationPitch); } } @Override public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) { EnumFacing enumfacing = (EnumFacing)state.getValue(FACING); switch(enumfacing) { case EAST: return PIPE_ED; case SOUTH: return PIPE_SD; case WEST: return PIPE_WD; case NORTH: default: return PIPE_ND; } } @Override public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, Entity entityIn) { addCollisionBoxToList(pos, entityBox, collidingBoxes, state.getBoundingBox(worldIn, pos)); addCollisionBoxToList(pos, entityBox, collidingBoxes, this.getFrontShape(state)); addCollisionBoxToList(pos, entityBox, collidingBoxes, this.getSideShape(state)); } private AxisAlignedBB getFrontShape(IBlockState state) { switch((EnumFacing)state.getValue(FACING)) { case EAST: return PIPE_EB; case SOUTH: return PIPE_SB; case WEST: return PIPE_WF; case NORTH: default: return PIPE_NF; } } private AxisAlignedBB getSideShape(IBlockState state) { switch ((EnumFacing)state.getValue(FACING)) { case EAST: return PIPE_ER; case SOUTH: return PIPE_SL; case WEST: return PIPE_WL; case NORTH: default: return PIPE_NR; } } public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) { this.setDefaultFacing(worldIn, pos, state); } private void setDefaultFacing(World worldIn, BlockPos pos, IBlockState state) { if (!worldIn.isRemote) { IBlockState iblockstate = worldIn.getBlockState(pos.north()); IBlockState iblockstate1 = worldIn.getBlockState(pos.south()); IBlockState iblockstate2 = worldIn.getBlockState(pos.west()); IBlockState iblockstate3 = worldIn.getBlockState(pos.east()); EnumFacing enumfacing = (EnumFacing)state.getValue(FACING); if (enumfacing == EnumFacing.NORTH && iblockstate.isFullBlock() && !iblockstate1.isFullBlock()) { enumfacing = EnumFacing.SOUTH; } else if (enumfacing == EnumFacing.SOUTH && iblockstate1.isFullBlock() && !iblockstate.isFullBlock()) { enumfacing = EnumFacing.NORTH; } else if (enumfacing == EnumFacing.WEST && iblockstate2.isFullBlock() && !iblockstate3.isFullBlock()) { enumfacing = EnumFacing.EAST; } else if (enumfacing == EnumFacing.EAST && iblockstate3.isFullBlock() && !iblockstate2.isFullBlock()) { enumfacing = EnumFacing.WEST; } worldIn.setBlockState(pos, state.withProperty(FACING, enumfacing), 2); } } public static void setState(boolean active, World worldIn, BlockPos pos) { IBlockState iblockstate = worldIn.getBlockState(pos); worldIn.setBlockState(pos, MarioBlocks.warp_pipe_base.getDefaultState().withProperty(FACING, iblockstate.getValue(FACING)), 3); worldIn.setBlockState(pos, MarioBlocks.warp_pipe_base.getDefaultState().withProperty(FACING, iblockstate.getValue(FACING)), 3); } public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) { return this.getDefaultState().withProperty(FACING, placer.getHorizontalFacing().getOpposite()); } public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) { worldIn.setBlockState(pos, state.withProperty(FACING, placer.getHorizontalFacing().getOpposite()), 2); } public IBlockState getStateFromMeta(int meta) { EnumFacing enumfacing = EnumFacing.getFront(meta); if (enumfacing.getAxis() == EnumFacing.Axis.Y) { enumfacing = EnumFacing.NORTH; } return this.getDefaultState().withProperty(FACING, enumfacing); } public int getMetaFromState(IBlockState state) { return ((EnumFacing)state.getValue(FACING)).getIndex(); } public IBlockState withRotation(IBlockState state, Rotation rot) { return state.withProperty(FACING, rot.rotate((EnumFacing)state.getValue(FACING))); } public IBlockState withMirror(IBlockState state, Mirror mirrorIn) { return state.withRotation(mirrorIn.toRotation((EnumFacing)state.getValue(FACING))); } protected BlockStateContainer createBlockState() { return new BlockStateContainer(this, new IProperty[] {FACING}); } @Override public boolean isOpaqueCube(IBlockState state) { return false; } @Override public boolean isFullCube(IBlockState state) { return false; } @Override public void func_190948_a(ItemStack stack, EntityPlayer player, List<String> tooltip, boolean advanced) { tooltip.add("" + TextFormatting.DARK_RED + "Super Mario Bros."); tooltip.add(""); if(Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { tooltip.add("" + TextFormatting.GOLD + "One of the main modes of transportation that transports the traveler to the other end."); } else { tooltip.add("" + TextFormatting.WHITE + "Hold " + TextFormatting.AQUA + TextFormatting.UNDERLINE + "LShift" + TextFormatting.RESET + " for more information."); } } @Override public TileEntity createNewTileEntity(World worldIn, int meta) { return new TileEntityWarpPipe(); } } Thank you for your time.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.