Jump 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.

Haffel

Members
  • Joined

  • Last visited

  1. Hi I have a very strange problem. I have a block, its not a full cube, textures and model works perfectly. But if my head is at the block, i have a missing texture at my whole screen. I dont get any error or something else. I searched a long time but i only found problems where the block had a missing texture, nothing to my problem. My Block class: package me.haffel.cr.block; import java.io.FileNotFoundException; import me.haffel.cr.client.gui.GuiCashRegisterSeeBuy; import me.haffel.cr.client.gui.GuiCashRegisterSetCode; import me.haffel.cr.json.CrFiles; import net.minecraft.block.Block; import net.minecraft.block.BlockHorizontal; 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.client.Minecraft; import net.minecraft.client.resources.I18n; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.EnumBlockRenderType; 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.world.Explosion; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; public class BlockCashRegister extends Block { public static final PropertyDirection FACING = BlockHorizontal.FACING; /** Size of bounding Box*/ protected static final AxisAlignedBB AABB = new AxisAlignedBB(0.0625D, 0.0D, 0.0625D, 0.9375D, 0.875D, 0.9375D); /** Block position for other classes */ public static BlockPos crPos; public BlockCashRegister(Material materialIn) { super(materialIn); this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH)); this.setBlockUnbreakable(); } /** * Called when block is added in the World */ public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) { this.setDefaultFacing(worldIn, pos, state); this.crPos = pos; Minecraft.getMinecraft().displayGuiScreen(new GuiCashRegisterSetCode()); } @Override /** * Fired when a Player destroys the cash register, used to delete it's file * * @param worldIn * @param pos * @param state */ public void onBlockDestroyedByPlayer(World worldIn, BlockPos pos, IBlockState state) { super.onBlockDestroyedByPlayer(worldIn, pos, state); try { CrFiles.deleteCrFile(Minecraft.getMinecraft().mcDataDir + "/saves/" + Minecraft.getMinecraft().getIntegratedServer().getFolderName() + "/cash_registers/" + pos.getX() + " - " + pos.getY() + " - " + pos.getZ() + ".json"); } catch (FileNotFoundException e) { e.printStackTrace(); } } 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(World worldIn, BlockPos pos) { IBlockState iblockstate = worldIn.getBlockState(pos); worldIn.setBlockState(pos, _Block.cash_register.getDefaultState().withProperty(FACING, iblockstate.getValue(FACING)), 3); worldIn.setBlockState(pos, _Block.cash_register.getDefaultState().withProperty(FACING, iblockstate.getValue(FACING)), 3); } /** * Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the * IBlockstate */ 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 IBlockState getStateFromMeta(int meta) { EnumFacing enumfacing = EnumFacing.getFront(meta); if(enumfacing.getAxis() == EnumFacing.Axis.Y) { enumfacing = EnumFacing.NORTH; } return this.getDefaultState().withProperty(FACING, enumfacing); } /** * Convert the BlockState into the correct metadata value */ public int getMetaFromState(IBlockState state) { return ((EnumFacing)state.getValue(FACING)).getIndex(); } /** * Returns the blockstate with the given rotation from the passed blockstate. If inapplicable, returns the passed * blockstate. */ public IBlockState withRotation(IBlockState state, Rotation rot) { return state.withProperty(FACING, rot.rotate((EnumFacing)state.getValue(FACING))); } /** * Returns the blockstate with the given mirror of the passed blockstate. If inapplicable, returns the passed * blockstate. */ 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}); } /** * Set bounding Box */ public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) { return AABB; } public boolean isFullBlock() { return false; } public boolean isOpaqueCube(IBlockState state) { return false; } @Override public EnumBlockRenderType getRenderType(IBlockState state) { return EnumBlockRenderType.MODEL; } @Override /** * Fired when the player makes a rightclick on the block */ public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing heldItem, float side, float hitX, float hitY) { this.crPos = pos; if(!worldIn.isRemote) { Minecraft.getMinecraft().displayGuiScreen(new GuiCashRegisterSeeBuy(I18n.format("cr.gui.seebuy.titel", new Object[0]), I18n.format("cr.gui.seebuy.description", new Object[0]), 0)); } return true; } }

Important Information

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

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.