Jump to content

RoyalReject

Members
  • Posts

    33
  • Joined

  • Last visited

Recent Profile Visitors

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

RoyalReject's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. I ended up creating a TileEntity and got it to store its Facing value in nbt. public class TileCollector extends TileEntity implements ITickable{ private EnumFacing facing; public EnumFacing getFacing(){ if(facing != null) { return facing; } return EnumFacing.NORTH; } @Override public void update(){ // TODO Auto-generated method stub } public void setFacing(EnumFacing facing){ this.facing = facing; markDirty(); } @Override public void readFromNBT(NBTTagCompound compound) { facing = EnumFacing.byHorizontalIndex(compound.getInteger("Facing")); super.readFromNBT(compound); } @Override public NBTTagCompound writeToNBT(NBTTagCompound compound){ super.writeToNBT(compound); compound.setInteger("Facing", facing.getHorizontalIndex()); return compound; } @Override public SPacketUpdateTileEntity getUpdatePacket(){ return new SPacketUpdateTileEntity(this.pos, 1, this.getUpdateTag()); } @Override public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity pkt){ super.onDataPacket(net, pkt); handleUpdateTag(pkt.getNbtCompound()); } @Override public NBTTagCompound getUpdateTag(){ return this.writeToNBT(new NBTTagCompound()); } } And then changed by block class to overtire @Override public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos){ TileCollector collector = (TileCollector) worldIn.getTileEntity(pos); return state.withProperty(FACING, collector.getFacing()); } @Override public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack){ TileCollector collector = (TileCollector) worldIn.getTileEntity(pos);; collector.setFacing(placer.getHorizontalFacing().getOpposite()); }
  2. Would it be possible to store anymore states in a tileEntity to affect the texture and/or orientation of the block?
  3. If that was the case i have 5 different enums in tier and it work? or I just misunderstanding you?
  4. So I currently have my block class setup and wanted my block to change face based on its direction no big deal, but I also use the same class to register different blocks via Enum values, basically I am trying to return 2 blockstates and wondered if it was possible. Because currently I can get it to rotate, but all blocks have same texture, otherwise i can get it to have different textures but then it no longer rotates public class BlockTier extends Block{ public static final PropertyEnum<EnumTier> TIER = PropertyEnum.create("tier", EnumTier.class); public static final IProperty<EnumFacing> FACING = BlockHorizontal.FACING; public BlockTier(Material m, MapColor c) { super(m, c); } @Nonnull @Override protected BlockStateContainer createBlockState() { return new BlockStateContainer(this, TIER, FACING); } @Override @Deprecated public IBlockState getStateFromMeta(int meta){ return this.getDefaultState().withProperty(FACING, EnumFacing.byHorizontalIndex(meta)).withProperty(TIER, EnumTier.byMeta(meta)); //FIXED } @Override public int getMetaFromState(IBlockState state){ return state.getValue(TIER).ordinal() + state.getValue(FACING).getHorizontalIndex(); } @Override public boolean hasTileEntity(IBlockState state){ return true; } @Override public int damageDropped(IBlockState state){ return state.getValue(TIER).ordinal(); } @Override public void getSubBlocks(CreativeTabs itemIn, NonNullList<ItemStack> items){ for (EnumTier tier : EnumTier.VALUES){ items.add(new ItemStack(this, 1, tier.ordinal())); } } @Nonnull @Override public IBlockState getStateForPlacement(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull EnumFacing facing, float hitX, float hitY, float hitZ, int meta, @Nonnull EntityLivingBase placer, EnumHand hand){ return getStateFromMeta(meta).withProperty(FACING, placer.getHorizontalFacing().getOpposite()); }
  5. I thought there used to be something similar to .canSeeSky check for players and I cant seem to find it. Basically i was wondering how i could check if the player was exposed to the sky with no blocks overhead.
  6. I was wondering what would be the approach to generate a structure in both generated and none generated chunks and then send a message of what chunk it was generated in
  7. @Override public SPacketUpdateTileEntity getUpdatePacket() { ModMain.logger.warning("getUpdatePacket()"); NBTTagCompound nbtTag = new NBTTagCompound(); this.writeToNBT(nbtTag); return new SPacketUpdateTileEntity(getPos(), 1, nbtTag); } Try setting return statement to return new SPacketUpdateTileEntity(this.pos, 3, this.getUpdateTag()); or just change 1 to 3
  8. I just messed around with trying to lock Recipes through the book but i am still able to craft locked recipes
  9. The issue I am is wrapping my head around how I would set it up. Basically any player will be able to "claim" a recipe. Then after that happens would disallow other players crafting whatever item they "claimed"
  10. Then how would i stop the player from crafting the items. I cannot think of anything else
  11. one yes its weird testing but it works. and b that was my thought but it still gives me the button but does not take the wood.
  12. Here is my class: public class Test { ArrayList<Item> items = new ArrayList<Item>(); @SubscribeEvent public void onCraft(ItemCraftedEvent event) { items.add(Item.getByNameOrId("minecraft:wooden_button")); if(!event.player.world.isRemote) { event.player.sendMessage(new TextComponentString("Test1")); if(isItemIn(event.crafting.getItem())) { event.player.sendMessage(new TextComponentString("Patented Item")); event.setCanceled(true); } } } public boolean isItemIn(Item item) { for(int i = 0; i < items.size(); i++) { if(items.get(i) == item) { return true; } } return false; } } I am trying to stop the crafting of an item in an arraylist, while it does cancel the event it still gives the crafting result while not using the wood leaving it in the crafting bench
  13. All commands, i have not figured out how i can do it for a few set of players instead of everyone
  14. I was wondering if there was a way to temporally disable the use of commands from a player or an x amount of time and then commands return to normal afterwards
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.