Jump to content

Recommended Posts

Posted (edited)

Now, I saw this post.

I thought, you know, let's add that to my mod. So I basically did the things in there and made some changes. But it doesn't work.

Here's my block class.

public class BlockAutoMiner extends Block {

	public static final PropertyDirection FACING = BlockHorizontal.FACING;
	public static IProperty ACTIVATED = PropertyBool.create("activated");

	public BlockAutoMiner() {
		super(Material.PISTON);
		setDefaultState(
				blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH).withProperty(ACTIVATED, false));
	}

	@Override
	public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) {
		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 = 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);
		}
	}

	@Override
	public IBlockState getStateForPlacement(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY,
			float hitZ, int meta, EntityLivingBase placer) {
		return getDefaultState().withProperty(FACING, placer.getHorizontalFacing().getOpposite());
	}

	@Override
	public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer,
			ItemStack stack) {
		worldIn.setBlockState(pos, state.withProperty(FACING, placer.getHorizontalFacing()), 2);
		if (worldIn.getTileEntity(pos) instanceof TileEntityAutoMiner) {
			TileEntityAutoMiner te = (TileEntityAutoMiner) worldIn.getTileEntity(pos);
			te.setLinePos(pos);
		}
	}

	@Override
	public IBlockState getStateFromMeta(int meta) {
		EnumFacing enumfacing = EnumFacing.getFront(meta);

		if (enumfacing.getAxis() == EnumFacing.Axis.Y) {
			enumfacing = EnumFacing.NORTH;
		}

		return getDefaultState().withProperty(FACING, enumfacing);
	}

	@Override
	public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) {
		TileEntityAutoMiner te = (TileEntityAutoMiner) worldIn.getTileEntity(pos);
		return state.withProperty(ACTIVATED, te.ACTIVATED);
	}

	@Override
	public int getMetaFromState(IBlockState state) {
		return state.getValue(FACING).getIndex();
	}

	@Override
	public IBlockState withRotation(IBlockState state, Rotation rot) {
		return state.withProperty(FACING, rot.rotate(state.getValue(FACING)));
	}

	@Override
	public IBlockState withMirror(IBlockState state, Mirror mirrorIn) {
		return state.withRotation(mirrorIn.toRotation(state.getValue(FACING)));
	}

	@Override
	protected BlockStateContainer createBlockState() {
		return new BlockStateContainer(this, new IProperty[] { FACING, ACTIVATED });
	}

	@Override
	@SideOnly(Side.CLIENT)
	public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand) {
		if (worldIn.getTileEntity(pos) instanceof TileEntityAutoMiner) {
			TileEntityAutoMiner te = (TileEntityAutoMiner) worldIn.getTileEntity(pos);
			if (te.ACTIVATED) {
				EnumFacing enumfacing = stateIn.getValue(FACING);
				double d0 = pos.getX() + 0.5D;
				double d1 = pos.getY() + 0.5D;
				double d2 = pos.getZ() + 0.5D;
				double d3 = 0.52D;
				double d4 = rand.nextDouble() * 0.6D - 0.3D;

				switch (enumfacing) {
				case WEST:
					worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0 + d3, d1, d2 + d4, 0.0D, 0.0D, 0.0D,
							new int[0]);
					break;
				case EAST:
					worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0 - d3, d1, d2 + d4, 0.0D, 0.0D, 0.0D,
							new int[0]);
					break;
				case NORTH:
					worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0 + d4, d1, d2 + d3, 0.0D, 0.0D, 0.0D,
							new int[0]);
					break;
				case SOUTH:
					worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0 + d4, d1, d2 - d3, 0.0D, 0.0D, 0.0D,
							new int[0]);
				default:
					break;
				}
			}
		}
	}

	@Override
	public void onBlockClicked(World worldIn, BlockPos pos, EntityPlayer playerIn) {
		if (playerIn.getHeldItemMainhand().getItem() == AMItems.LINE_BUTTON && worldIn.isRemote) {
			playerIn.swingArm(EnumHand.MAIN_HAND);
		} else if (playerIn.getHeldItemMainhand().getItem() == AMItems.LINE_BUTTON && !worldIn.isRemote) {
			if (worldIn.getTileEntity(pos) instanceof TileEntityAutoMiner) {
				TileEntityAutoMiner te = (TileEntityAutoMiner) worldIn.getTileEntity(pos);
				te.setDrawLine(false);
			}
		}
	}

	@Override
	public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn,
			EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
		if (!worldIn.isRemote) {
			if (hand == EnumHand.MAIN_HAND) {
				if (TileEntityFurnace.isItemFuel(playerIn.getHeldItem(hand))) {
					if (!playerIn.isCreative()) {
						playerIn.getHeldItem(hand).shrink(1);
					}
					if (worldIn.getTileEntity(pos) instanceof TileEntityAutoMiner) {
						TileEntityAutoMiner te = (TileEntityAutoMiner) worldIn.getTileEntity(pos);
						te.addFuel(getItemBurnTime(playerIn.getHeldItem(hand)));
					}
				} else if (playerIn.getHeldItem(hand).getItem() == AMItems.WRENCH) {
					if (worldIn.getTileEntity(pos) instanceof TileEntityAutoMiner) {
						TileEntityAutoMiner te = (TileEntityAutoMiner) worldIn.getTileEntity(pos);
						if (te.ACTIVATED) {
							te.setActivated(false);
						} else {
							if (te.FUEL_AMOUNT > 0) {
								te.setActivated(true);
							}
						}
					}
				} else if (playerIn.getHeldItem(hand).getItem() == Item.getItemFromBlock(Blocks.TORCH)) {
					if (!playerIn.isCreative()) {
						playerIn.getHeldItem(hand).shrink(1);
					}
					if (worldIn.getTileEntity(pos) instanceof TileEntityAutoMiner) {
						TileEntityAutoMiner te = (TileEntityAutoMiner) worldIn.getTileEntity(pos);
						te.addTorch();
					}
				} else if (playerIn.getHeldItem(hand).getItem() == Item.getItemFromBlock(Blocks.COBBLESTONE)) {
					if (!playerIn.isCreative()) {
						playerIn.getHeldItem(hand).shrink(1);
					}
					if (worldIn.getTileEntity(pos) instanceof TileEntityAutoMiner) {
						TileEntityAutoMiner te = (TileEntityAutoMiner) worldIn.getTileEntity(pos);
						te.addBlock();
					}
				} else if (playerIn.getHeldItem(hand).getItem() == AMItems.LINE_BUTTON) {
					if (worldIn.getTileEntity(pos) instanceof TileEntityAutoMiner) {
						TileEntityAutoMiner te = (TileEntityAutoMiner) worldIn.getTileEntity(pos);
						te.setDrawLine(true);
					}
				}
			}
		} else {
			if (hand == EnumHand.MAIN_HAND) {
				if (playerIn.getHeldItem(hand).getItem() == AMItems.WRENCH
						|| TileEntityFurnace.isItemFuel(playerIn.getHeldItem(hand))
						|| playerIn.getHeldItem(hand).getItem() == AMItems.LINE_BUTTON) {
					Minecraft.getMinecraft().player.swingArm(hand);
				}
			}
		}
		return true;

	}

	private int getItemBurnTime(ItemStack stack) {
		if (stack.isEmpty()) {
			return 0;
		} else {
			Item item = stack.getItem();
			if (!item.getRegistryName().getResourceDomain().equals("minecraft")) {
				int burnTime = net.minecraftforge.fml.common.registry.GameRegistry.getFuelValue(stack);
				if (burnTime != 0) {
					return burnTime;
				}
			}

			if (item == Item.getItemFromBlock(Blocks.WOODEN_SLAB)) {
				return 160;
			} else if (item == Item.getItemFromBlock(Blocks.WOOL)) {
				return 120;
			} else if (item == Item.getItemFromBlock(Blocks.CARPET)) {
				return 80;
			} else if (item == Item.getItemFromBlock(Blocks.LADDER)) {
				return 320;
			} else if (item == Item.getItemFromBlock(Blocks.WOODEN_BUTTON)) {
				return 120;
			} else if (Block.getBlockFromItem(item).getDefaultState().getMaterial() == Material.WOOD) {
				return 320;
			} else if (item == Item.getItemFromBlock(Blocks.COAL_BLOCK)) {
				return 16000;
			} else if (item instanceof ItemTool && "WOOD".equals(((ItemTool) item).getToolMaterialName())) {
				return 200;
			} else if (item instanceof ItemSword && "WOOD".equals(((ItemSword) item).getToolMaterialName())) {
				return 200;
			} else if (item instanceof ItemHoe && "WOOD".equals(((ItemHoe) item).getMaterialName())) {
				return 200;
			} else if (item == Items.STICK) {
				return 120;
			} else if (item != Items.BOW && item != Items.FISHING_ROD) {
				if (item == Items.SIGN) {
					return 200;
				} else if (item == Items.COAL) {
					return 1600;
				} else if (item == Items.LAVA_BUCKET) {
					return 20000;
				} else if (item != Item.getItemFromBlock(Blocks.SAPLING) && item != Items.BOWL) {
					if (item == Items.BLAZE_ROD) {
						return 2400;
					} else if (item instanceof ItemDoor && item != Items.IRON_DOOR) {
						return 200;
					} else {
						return item instanceof ItemBoat ? 400 : 0;
					}
				} else {
					return 120;
				}
			} else {
				return 320;
			}
		}
	}

	@Override
	public void breakBlock(World worldIn, BlockPos pos, IBlockState state) {
		if (!worldIn.isRemote) {
			if (worldIn.getTileEntity(pos) instanceof TileEntityAutoMiner) {
				TileEntityAutoMiner te = (TileEntityAutoMiner) worldIn.getTileEntity(pos);
				for (int i = 0; i < te.TORCHES; i++) {
					worldIn.spawnEntity(new EntityItem(worldIn, pos.getX(), pos.getY() + 1, pos.getZ(),
							new ItemStack(Blocks.TORCH)));
				}
				for (int x = 0; x < te.BLOCKS; x++) {
					worldIn.spawnEntity(new EntityItem(worldIn, pos.getX(), pos.getY() + 1, pos.getZ(),
							new ItemStack(Blocks.COBBLESTONE)));
				}
			}
		}
		super.breakBlock(worldIn, pos, state);
	}

	@Override
	public boolean hasTileEntity() {
		return true;
	}

	@Override
	public TileEntity createTileEntity(World world, IBlockState state) {
		return new TileEntityAutoMiner();
	}

	@Override
	public boolean hasTileEntity(IBlockState state) {
		return true;
	}
}

My tile entity class.

public class TileEntityAutoMiner extends TileEntity implements ITickable {

	public int FUEL_AMOUNT = 0;
	public boolean ACTIVATED = false;
	public boolean UPDATE = false;
	public int TICKS = 0;
	public int TORCHES = 0;
	public int PLACE_TORCH = 0;
	public int BLOCKS = 0;
	public boolean DRAW_LINE = false;
	public BlockPos BEGIN_LINE_POS = new BlockPos(0, 0, 0);
	public int DRAW_LINE_X = 0;
	public int DRAW_LINE_Y = 0;
	public int DRAW_LINE_Z = 0;

	public TileEntityAutoMiner() {
	}

	public void addFuel(int amount) {
		FUEL_AMOUNT += amount;
		IBlockState state = world.getBlockState(pos);
		world.markBlockRangeForRenderUpdate(pos, pos);
		markDirty();
	}

	public void removeFuel() {
		if (FUEL_AMOUNT > 0) {
			FUEL_AMOUNT--;
			IBlockState state = world.getBlockState(pos);
			world.markBlockRangeForRenderUpdate(pos, pos);
			markDirty();
		}
	}

	public void addTorch() {
		TORCHES++;
		IBlockState state = world.getBlockState(pos);
		world.markBlockRangeForRenderUpdate(pos, pos);
		markDirty();
	}

	public void removeTorches(int amount) {
		TORCHES -= amount;
		IBlockState state = world.getBlockState(pos);
		world.markBlockRangeForRenderUpdate(pos, pos);
		markDirty();
	}

	public void addPlaceTorch() {
		PLACE_TORCH++;
		IBlockState state = world.getBlockState(pos);
		world.markBlockRangeForRenderUpdate(pos, pos);
		markDirty();
	}

	public void removePlaceTorches() {
		PLACE_TORCH = 0;
		IBlockState state = world.getBlockState(pos);
		world.markBlockRangeForRenderUpdate(pos, pos);
		markDirty();
	}

	public void addBlock() {
		BLOCKS++;
		IBlockState state = world.getBlockState(pos);
		world.markBlockRangeForRenderUpdate(pos, pos);
		markDirty();
	}

	public void removeBlock() {
		BLOCKS--;
		IBlockState state = world.getBlockState(pos);
		world.markBlockRangeForRenderUpdate(pos, pos);
		markDirty();
	}

	public void setActivated(boolean active) {
		ACTIVATED = active;
		markDirty();
		IBlockState state = world.getBlockState(pos);
		world.markBlockRangeForRenderUpdate(pos, pos);
		world.notifyBlockUpdate(pos, state, state, 3);
		world.scheduleBlockUpdate(pos, getBlockType(), 0, 0);
	}

	public void addTick() {
		TICKS++;
		markDirty();
		IBlockState state = world.getBlockState(pos);
		world.markBlockRangeForRenderUpdate(pos, pos);
	}

	public void removeTicks() {
		TICKS = 0;
		markDirty();
		IBlockState state = world.getBlockState(pos);
		world.markBlockRangeForRenderUpdate(pos, pos);
	}

	public void setDrawLine(boolean draw) {
		DRAW_LINE = draw;
		markDirty();
		IBlockState state = world.getBlockState(pos);
		world.markBlockRangeForRenderUpdate(pos, pos);
	}

	public void setLinePos(BlockPos pos) {
		BEGIN_LINE_POS = pos;
		DRAW_LINE_X = pos.getX();
		DRAW_LINE_Y = pos.getY();
		DRAW_LINE_Z = pos.getZ();
		markDirty();
		IBlockState state = world.getBlockState(pos);
		world.markBlockRangeForRenderUpdate(pos, pos);
	}

	@Override
	public NBTTagCompound writeToNBT(NBTTagCompound compound) {
		super.writeToNBT(compound);
		compound.setInteger("FuelAmount", FUEL_AMOUNT);
		compound.setBoolean("Activated", ACTIVATED);
		compound.setInteger("Ticks", TICKS);
		compound.setInteger("Torches", TORCHES);
		compound.setInteger("PlaceTorch", PLACE_TORCH);
		compound.setInteger("Blocks", BLOCKS);
		compound.setBoolean("DrawLine", DRAW_LINE);
		compound.setInteger("PosX", DRAW_LINE_X);
		compound.setInteger("PosY", DRAW_LINE_Y);
		compound.setInteger("PosZ", DRAW_LINE_Z);
		return compound;
	}

	@Override
	public void readFromNBT(NBTTagCompound compound) {
		super.readFromNBT(compound);
		FUEL_AMOUNT = compound.getInteger("FuelAmount");
		ACTIVATED = compound.getBoolean("Activated");
		TICKS = compound.getInteger("Ticks");
		TORCHES = compound.getInteger("Torches");
		PLACE_TORCH = compound.getInteger("PlaceTorch");
		BLOCKS = compound.getInteger("Blocks");
		DRAW_LINE = compound.getBoolean("DrawLine");
		DRAW_LINE_X = compound.getInteger("PosX");
		DRAW_LINE_Y = compound.getInteger("PosY");
		DRAW_LINE_Z = compound.getInteger("PosZ");
		BEGIN_LINE_POS = new BlockPos(DRAW_LINE_X, DRAW_LINE_Y, DRAW_LINE_Z);
	}

	@Override
	public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity pkt) {
		super.onDataPacket(net, pkt);
		handleUpdateTag(pkt.getNbtCompound());
	}

	@Override
	public SPacketUpdateTileEntity getUpdatePacket() {
		return new SPacketUpdateTileEntity(pos, 3, getUpdateTag());
	}

	@Override
	public NBTTagCompound getUpdateTag() {
		return writeToNBT(new NBTTagCompound());
	}

	@Override
	public void update() {
		if (ACTIVATED) {
			addTick();
			UPDATE = true;
			removeFuel();
			if (FUEL_AMOUNT <= 0) {
				FUEL_AMOUNT = 0;
				setActivated(false);
				markDirty();
			}
			if (TICKS == 20) {
				if (!world.isRemote) {
					EnumFacing facing = world.getBlockState(pos).getValue(BlockAutoMiner.FACING);
					EnumFacing facingL = facing.rotateYCCW();
					EnumFacing facingR = facing.rotateY();
					Random random = new Random();

					BlockPos positionC = pos.offset(world.getBlockState(pos).getValue(BlockAutoMiner.FACING));
					BlockPos positionL = positionC.offset(facingL);
					BlockPos positionR = positionC.offset(facingR);
					BlockPos positionCU = positionC.up();
					BlockPos positionLU = positionL.up();
					BlockPos positionRU = positionR.up();
					BlockPos positionCUU = positionCU.up();
					BlockPos positionLUU = positionLU.up();
					BlockPos positionRUU = positionRU.up();

					IBlockState stateC = world.getBlockState(positionC);
					IBlockState stateL = world.getBlockState(positionL);
					IBlockState stateR = world.getBlockState(positionR);
					IBlockState stateCU = world.getBlockState(positionCU);
					IBlockState stateLU = world.getBlockState(positionLU);
					IBlockState stateRU = world.getBlockState(positionRU);
					IBlockState stateCUU = world.getBlockState(positionCUU);
					IBlockState stateLUU = world.getBlockState(positionLUU);
					IBlockState stateRUU = world.getBlockState(positionRUU);

					List<ItemStack> stackC = stateC.getBlock().getDrops(world, positionC, stateC, 0);
					List<ItemStack> stackL = stateL.getBlock().getDrops(world, positionL, stateL, 0);
					List<ItemStack> stackR = stateR.getBlock().getDrops(world, positionR, stateR, 0);
					List<ItemStack> stackCU = stateCU.getBlock().getDrops(world, positionCU, stateCU, 0);
					List<ItemStack> stackLU = stateLU.getBlock().getDrops(world, positionLU, stateLU, 0);
					List<ItemStack> stackRU = stateRU.getBlock().getDrops(world, positionRU, stateRU, 0);
					List<ItemStack> stackCUU = stateCUU.getBlock().getDrops(world, positionCUU, stateCUU, 0);
					List<ItemStack> stackLUU = stateLUU.getBlock().getDrops(world, positionLUU, stateLUU, 0);
					List<ItemStack> stackRUU = stateRUU.getBlock().getDrops(world, positionRUU, stateRUU, 0);

					dropItems(stackC, stateC, positionC);
					dropItems(stackL, stateL, positionL);
					dropItems(stackR, stateR, positionR);
					dropItems(stackCU, stateCU, positionCU);
					dropItems(stackLU, stateLU, positionLU);
					dropItems(stackRU, stateRU, positionRU);
					dropItems(stackCUU, stateCUU, positionCUU);
					dropItems(stackLUU, stateLUU, positionLUU);
					dropItems(stackRUU, stateRUU, positionRUU);

					setBlockToAir(stateC, positionC);
					setBlockToAir(stateL, positionL);
					setBlockToAir(stateR, positionR);
					setBlockToAir(stateCU, positionCU);
					setBlockToAir(stateLU, positionLU);
					setBlockToAir(stateRU, positionRU);
					setBlockToAir(stateCUU, positionCUU);
					setBlockToAir(stateLUU, positionLUU);
					setBlockToAir(stateRUU, positionRUU);

					if ((TORCHES >= 2) && (PLACE_TORCH >= 6)) {
						BlockPos positionLLU = positionLU.offset(facingL);
						BlockPos positionRRU = positionRU.offset(facingR);

						if (world.getBlockState(positionLLU).isSideSolid(world, positionLLU, facingR)
								&& (world.getBlockState(positionLU).getMaterial() == Material.AIR)) {
							if (world.setBlockState(positionLU,
									Blocks.TORCH.getDefaultState().withProperty(BlockTorch.FACING, facingR))) {
								removeTorches(1);
								removePlaceTorches();
							}
						}
						if (world.getBlockState(positionRRU).isSideSolid(world, positionRRU, facingL)
								&& (world.getBlockState(positionRU).getMaterial() == Material.AIR)) {
							if (world.setBlockState(positionRU,
									Blocks.TORCH.getDefaultState().withProperty(BlockTorch.FACING, facingL))) {
								removeTorches(1);
								removePlaceTorches();
							}
						}
					} else {
						addPlaceTorch();
					}

					BlockPos positionD = positionC.down();
					IBlockState stateD = world.getBlockState(positionD);
					if (BLOCKS > 0) {
						if (!stateD.isTopSolid()) {
							world.setBlockState(positionD, Blocks.COBBLESTONE.getDefaultState());
							removeBlock();
						}
					} else {
						if (!stateD.isTopSolid()) {
							setActivated(false);
							removeTicks();
						}
					}
					if (!world.getBlockState(pos.down()).isTopSolid()) {
						setActivated(false);
						removeTicks();
					}
					if (world.getBlockState(positionC).getMaterial().isSolid()) {
						setActivated(false);
						removeTicks();
					}
				}
			}
			if (TICKS == 40) {
				if (!world.isRemote) {
					BlockPos position = pos.offset(world.getBlockState(pos).getValue(BlockAutoMiner.FACING));
					BlockPos position1 = pos;
					world.setBlockState(position, world.getBlockState(pos));
					TileEntityAutoMiner te = new TileEntityAutoMiner();
					te.ACTIVATED = ACTIVATED;
					te.FUEL_AMOUNT = FUEL_AMOUNT;
					te.TICKS = TICKS;
					te.UPDATE = UPDATE;
					te.TORCHES = TORCHES;
					te.PLACE_TORCH = PLACE_TORCH;
					te.BLOCKS = BLOCKS;
					te.BEGIN_LINE_POS = BEGIN_LINE_POS;
					te.DRAW_LINE = DRAW_LINE;
					te.DRAW_LINE_X = DRAW_LINE_X;
					te.DRAW_LINE_Y = DRAW_LINE_Y;
					te.DRAW_LINE_Z = DRAW_LINE_Z;
					ACTIVATED = false;
					TICKS = 0;
					UPDATE = false;
					TORCHES = 0;
					PLACE_TORCH = 0;
					BLOCKS = 0;
					BEGIN_LINE_POS = new BlockPos(0, 0, 0);
					DRAW_LINE = false;
					DRAW_LINE_X = 0;
					DRAW_LINE_Y = 0;
					DRAW_LINE_Z = 0;
					world.setTileEntity(position, te);
					world.setBlockToAir(position1);
				}
			}
		} else {
			if (UPDATE) {
				IBlockState state = world.getBlockState(pos);
				world.markBlockRangeForRenderUpdate(pos, pos);
			}
			UPDATE = false;
		}
		if (TICKS >= 40) {
			removeTicks();
		}
		if (DRAW_LINE) {
			GL11.glPushMatrix();
			GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
			GL11.glTranslated(-pos.getX(), -pos.getY(), -pos.getZ());
			GL11.glDisable(GL11.GL_LIGHTING);
			GL11.glDisable(GL11.GL_TEXTURE_2D);
			drawLine(new Vec3d(DRAW_LINE_X, DRAW_LINE_Y, DRAW_LINE_Z), new Vec3d(getPos()));
			GL11.glPopAttrib();
			GL11.glPopMatrix();
		}
	}

	private void drawLine(Vec3d blockA, Vec3d blockB) {
		Tessellator tess = Tessellator.getInstance();
		BufferBuilder buff = tess.getBuffer();
		blockB.addVector(0, 1, 0);
		blockB.addVector(0, -1, 0);
		blockA.addVector(0, -0.02f, 0);
		buff.begin(7, buff.getVertexFormat());
		buff.color(0F, 1F, 1F, 1F);

		Vec3d recLong = blockA.subtract(blockB);
		Vec3d perpendicular = Vec3d.fromPitchYaw(1.0F, 1.0F);
		perpendicular = perpendicular.normalize();

		float Width = 1f / 16f;

		Vec3d R1 = blockA.subtract(blockB);
		Vec3d R2 = blockA.subtract(blockB);
		Vec3d R3 = blockA.subtract(blockB);
		Vec3d R4 = blockA.subtract(blockB);

		R1.addVector(blockA.x + perpendicular.x * Width, 0, 0);
		R1.addVector(0, 0, blockA.z + perpendicular.z * Width);
		R2.addVector(blockA.x - perpendicular.x * Width, 0, 0);
		R2.addVector(0, 0, blockA.z - perpendicular.z * Width);
		R1.addVector(0, blockA.y - 0.01, 0);
		R2.addVector(0, blockA.y - 0.01, 0);

		R3.addVector(blockB.x + perpendicular.x * Width, 0, 0);
		R3.addVector(0, 0, blockB.z + perpendicular.z * Width);
		R4.addVector(blockB.x - perpendicular.x * Width, 0, 0);
		R4.addVector(0, 0, blockB.z - perpendicular.z * Width);
		R3.addVector(0, blockB.y + 0.75, 0);
		R4.addVector(0, blockB.y + 0.75, 0);

		int[] a = { (int) (R1.x + 0.5), (int) R1.y, (int) (R1.z + 0.5) };
		int[] b = { (int) (R3.x + 0.5), (int) R3.y, (int) (R3.z + 0.5) };
		int[] c = { (int) (R4.x + 0.5), (int) R4.y, (int) (R4.z + 0.5) };
		int[] d = { (int) (R2.x + 0.5), (int) R2.y, (int) (R2.z + 0.5) };

		buff.addVertexData(a);
		buff.addVertexData(b);
		buff.addVertexData(c);
		buff.addVertexData(d);

		tess.draw();
	}

	private void dropItems(List<ItemStack> stackList, IBlockState state, BlockPos pos) {
		for (int i = 0; i < stackList.size(); i++) {
			ItemStack stack = stackList.get(i);
			if ((stack.getItem() instanceof ItemBlock)
					&& ((Block.getBlockFromItem(stack.getItem()).getBlockHardness(state, world, pos) < 0F)
							|| (Block.getBlockFromItem(stack.getItem()).getBlockHardness(state, world, pos) > 30F))) {
				continue;
			}
			world.spawnEntity(new EntityItem(world, pos.getX(), pos.getY() + 1, pos.getZ(), stack));
		}
	}

	private void setBlockToAir(IBlockState state, BlockPos pos) {
		if (!(state.getBlockHardness(world, pos) > 30F) && !(state.getBlockHardness(world, pos) < 0F)) {
			world.setBlockToAir(pos);
		}
	}
}

Also, how can I cancel the player breaking the block in the onBlockClicked() method?

Edited by Kokkie

Classes: 94

Lines of code: 12173

Other files: 206

Github repo: https://github.com/KokkieBeer/DeGeweldigeMod

Posted

Why are you trying to draw anything in your tile's update method? Not only is that a different thread, rendering is something that must be done each frame, not each tick. A tick is 1/20 of a second. A frame can literaly be any time value dependant on user's settings, monitor and other things. You must render your things in rederers/render events and nowhere else. 

44 minutes ago, Kokkie said:

buff.begin(7, buff.getVertexFormat());

getVertexFormat gets the current drawing format. As you are only starting to draw things this getter can't be used. See DefaultVertexFormats for available formats.

Posted
1 hour ago, V0idWa1k3r said:

Why are you trying to draw anything in your tile's update method? Not only is that a different thread, rendering is something that must be done each frame, not each tick. A tick is 1/20 of a second. A frame can literaly be any time value dependant on user's settings, monitor and other things. You must render your things in rederers/render events and nowhere else. 

Added a TESR.

 

1 hour ago, V0idWa1k3r said:

getVertexFormat gets the current drawing format. As you are only starting to draw things this getter can't be used. See DefaultVertexFormats for available formats.

Changed it to DefaultVertexFormats.POSITION_COLOR.

It doesn't work though.

Block.

public class BlockAutoMiner extends Block {

	public static final PropertyDirection FACING = BlockHorizontal.FACING;
	public static IProperty ACTIVATED = PropertyBool.create("activated");

	public BlockAutoMiner() {
		super(Material.PISTON);
		setDefaultState(
				blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH).withProperty(ACTIVATED, false));
	}

	@Override
	public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) {
		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 = 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);
		}
	}

	@Override
	public IBlockState getStateForPlacement(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY,
			float hitZ, int meta, EntityLivingBase placer) {
		return getDefaultState().withProperty(FACING, placer.getHorizontalFacing().getOpposite());
	}

	@Override
	public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer,
			ItemStack stack) {
		worldIn.setBlockState(pos, state.withProperty(FACING, placer.getHorizontalFacing()), 2);
		if (worldIn.getTileEntity(pos) instanceof TileEntityAutoMiner) {
			TileEntityAutoMiner te = (TileEntityAutoMiner) worldIn.getTileEntity(pos);
			te.setLinePos(pos);
		}
	}

	@Override
	public IBlockState getStateFromMeta(int meta) {
		EnumFacing enumfacing = EnumFacing.getFront(meta);

		if (enumfacing.getAxis() == EnumFacing.Axis.Y) {
			enumfacing = EnumFacing.NORTH;
		}

		return getDefaultState().withProperty(FACING, enumfacing);
	}

	@Override
	public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) {
		TileEntityAutoMiner te = (TileEntityAutoMiner) worldIn.getTileEntity(pos);
		return state.withProperty(ACTIVATED, te.ACTIVATED);
	}

	@Override
	public int getMetaFromState(IBlockState state) {
		return state.getValue(FACING).getIndex();
	}

	@Override
	public IBlockState withRotation(IBlockState state, Rotation rot) {
		return state.withProperty(FACING, rot.rotate(state.getValue(FACING)));
	}

	@Override
	public IBlockState withMirror(IBlockState state, Mirror mirrorIn) {
		return state.withRotation(mirrorIn.toRotation(state.getValue(FACING)));
	}

	@Override
	protected BlockStateContainer createBlockState() {
		return new BlockStateContainer(this, new IProperty[] { FACING, ACTIVATED });
	}

	@Override
	@SideOnly(Side.CLIENT)
	public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand) {
		if (worldIn.getTileEntity(pos) instanceof TileEntityAutoMiner) {
			TileEntityAutoMiner te = (TileEntityAutoMiner) worldIn.getTileEntity(pos);
			if (te.ACTIVATED) {
				EnumFacing enumfacing = stateIn.getValue(FACING);
				double d0 = pos.getX() + 0.5D;
				double d1 = pos.getY() + 0.5D;
				double d2 = pos.getZ() + 0.5D;
				double d3 = 0.52D;
				double d4 = rand.nextDouble() * 0.6D - 0.3D;

				switch (enumfacing) {
				case WEST:
					worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0 + d3, d1, d2 + d4, 0.0D, 0.0D, 0.0D,
							new int[0]);
					break;
				case EAST:
					worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0 - d3, d1, d2 + d4, 0.0D, 0.0D, 0.0D,
							new int[0]);
					break;
				case NORTH:
					worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0 + d4, d1, d2 + d3, 0.0D, 0.0D, 0.0D,
							new int[0]);
					break;
				case SOUTH:
					worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0 + d4, d1, d2 - d3, 0.0D, 0.0D, 0.0D,
							new int[0]);
				default:
					break;
				}
			}
		}
	}

	@Override
	public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn,
			EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
		if (!worldIn.isRemote) {
			if (hand == EnumHand.MAIN_HAND) {
				if (TileEntityFurnace.isItemFuel(playerIn.getHeldItem(hand))) {
					if (!playerIn.isCreative()) {
						playerIn.getHeldItem(hand).shrink(1);
					}
					if (worldIn.getTileEntity(pos) instanceof TileEntityAutoMiner) {
						TileEntityAutoMiner te = (TileEntityAutoMiner) worldIn.getTileEntity(pos);
						te.addFuel(getItemBurnTime(playerIn.getHeldItem(hand)));
					}
				} else if (playerIn.getHeldItem(hand).getItem() == AMItems.WRENCH) {
					if (worldIn.getTileEntity(pos) instanceof TileEntityAutoMiner) {
						TileEntityAutoMiner te = (TileEntityAutoMiner) worldIn.getTileEntity(pos);
						if (te.ACTIVATED) {
							te.setActivated(false);
						} else {
							if (te.FUEL_AMOUNT > 0) {
								te.setActivated(true);
							}
						}
					}
				} else if (playerIn.getHeldItem(hand).getItem() == Item.getItemFromBlock(Blocks.TORCH)) {
					if (!playerIn.isCreative()) {
						playerIn.getHeldItem(hand).shrink(1);
					}
					if (worldIn.getTileEntity(pos) instanceof TileEntityAutoMiner) {
						TileEntityAutoMiner te = (TileEntityAutoMiner) worldIn.getTileEntity(pos);
						te.addTorch();
					}
				} else if (playerIn.getHeldItem(hand).getItem() == Item.getItemFromBlock(Blocks.COBBLESTONE)) {
					if (!playerIn.isCreative()) {
						playerIn.getHeldItem(hand).shrink(1);
					}
					if (worldIn.getTileEntity(pos) instanceof TileEntityAutoMiner) {
						TileEntityAutoMiner te = (TileEntityAutoMiner) worldIn.getTileEntity(pos);
						te.addBlock();
					}
				} else if (playerIn.getHeldItem(hand).getItem() == AMItems.LINE_BUTTON) {
					if (worldIn.getTileEntity(pos) instanceof TileEntityAutoMiner) {
						TileEntityAutoMiner te = (TileEntityAutoMiner) worldIn.getTileEntity(pos);
						te.toggleDrawLine();
					}
				}
			}
		} else {
			if (hand == EnumHand.MAIN_HAND) {
				if (playerIn.getHeldItem(hand).getItem() == AMItems.WRENCH
						|| TileEntityFurnace.isItemFuel(playerIn.getHeldItem(hand))
						|| playerIn.getHeldItem(hand).getItem() == AMItems.LINE_BUTTON) {
					Minecraft.getMinecraft().player.swingArm(hand);
				}
			}
		}
		return true;

	}

	private int getItemBurnTime(ItemStack stack) {
		if (stack.isEmpty()) {
			return 0;
		} else {
			Item item = stack.getItem();
			if (!item.getRegistryName().getResourceDomain().equals("minecraft")) {
				int burnTime = net.minecraftforge.fml.common.registry.GameRegistry.getFuelValue(stack);
				if (burnTime != 0) {
					return burnTime;
				}
			}

			if (item == Item.getItemFromBlock(Blocks.WOODEN_SLAB)) {
				return 160;
			} else if (item == Item.getItemFromBlock(Blocks.WOOL)) {
				return 120;
			} else if (item == Item.getItemFromBlock(Blocks.CARPET)) {
				return 80;
			} else if (item == Item.getItemFromBlock(Blocks.LADDER)) {
				return 320;
			} else if (item == Item.getItemFromBlock(Blocks.WOODEN_BUTTON)) {
				return 120;
			} else if (Block.getBlockFromItem(item).getDefaultState().getMaterial() == Material.WOOD) {
				return 320;
			} else if (item == Item.getItemFromBlock(Blocks.COAL_BLOCK)) {
				return 16000;
			} else if (item instanceof ItemTool && "WOOD".equals(((ItemTool) item).getToolMaterialName())) {
				return 200;
			} else if (item instanceof ItemSword && "WOOD".equals(((ItemSword) item).getToolMaterialName())) {
				return 200;
			} else if (item instanceof ItemHoe && "WOOD".equals(((ItemHoe) item).getMaterialName())) {
				return 200;
			} else if (item == Items.STICK) {
				return 120;
			} else if (item != Items.BOW && item != Items.FISHING_ROD) {
				if (item == Items.SIGN) {
					return 200;
				} else if (item == Items.COAL) {
					return 1600;
				} else if (item == Items.LAVA_BUCKET) {
					return 20000;
				} else if (item != Item.getItemFromBlock(Blocks.SAPLING) && item != Items.BOWL) {
					if (item == Items.BLAZE_ROD) {
						return 2400;
					} else if (item instanceof ItemDoor && item != Items.IRON_DOOR) {
						return 200;
					} else {
						return item instanceof ItemBoat ? 400 : 0;
					}
				} else {
					return 120;
				}
			} else {
				return 320;
			}
		}
	}

	@Override
	public void breakBlock(World worldIn, BlockPos pos, IBlockState state) {
		if (!worldIn.isRemote) {
			if (worldIn.getTileEntity(pos) instanceof TileEntityAutoMiner) {
				TileEntityAutoMiner te = (TileEntityAutoMiner) worldIn.getTileEntity(pos);
				for (int i = 0; i < te.TORCHES; i++) {
					worldIn.spawnEntity(new EntityItem(worldIn, pos.getX(), pos.getY() + 1, pos.getZ(),
							new ItemStack(Blocks.TORCH)));
				}
				for (int x = 0; x < te.BLOCKS; x++) {
					worldIn.spawnEntity(new EntityItem(worldIn, pos.getX(), pos.getY() + 1, pos.getZ(),
							new ItemStack(Blocks.COBBLESTONE)));
				}
			}
		}
		super.breakBlock(worldIn, pos, state);
	}

	@Override
	public boolean hasTileEntity() {
		return true;
	}

	@Override
	public TileEntity createTileEntity(World world, IBlockState state) {
		return new TileEntityAutoMiner();
	}

	@Override
	public boolean hasTileEntity(IBlockState state) {
		return true;
	}
}

TileEntity.

public class TileEntityAutoMiner extends TileEntity implements ITickable {

	public int FUEL_AMOUNT = 0;
	public boolean ACTIVATED = false;
	public boolean UPDATE = false;
	public int TICKS = 0;
	public int TORCHES = 0;
	public int PLACE_TORCH = 0;
	public int BLOCKS = 0;
	public boolean DRAW_LINE = false;
	public BlockPos BEGIN_LINE_POS = new BlockPos(0, 0, 0);
	public int DRAW_LINE_X = 0;
	public int DRAW_LINE_Y = 0;
	public int DRAW_LINE_Z = 0;

	public TileEntityAutoMiner() {
	}

	public void addFuel(int amount) {
		FUEL_AMOUNT += amount;
		IBlockState state = world.getBlockState(pos);
		world.markBlockRangeForRenderUpdate(pos, pos);
		markDirty();
	}

	public void removeFuel() {
		if (FUEL_AMOUNT > 0) {
			FUEL_AMOUNT--;
			IBlockState state = world.getBlockState(pos);
			world.markBlockRangeForRenderUpdate(pos, pos);
			markDirty();
		}
	}

	public void addTorch() {
		TORCHES++;
		IBlockState state = world.getBlockState(pos);
		world.markBlockRangeForRenderUpdate(pos, pos);
		markDirty();
	}

	public void removeTorches(int amount) {
		TORCHES -= amount;
		IBlockState state = world.getBlockState(pos);
		world.markBlockRangeForRenderUpdate(pos, pos);
		markDirty();
	}

	public void addPlaceTorch() {
		PLACE_TORCH++;
		IBlockState state = world.getBlockState(pos);
		world.markBlockRangeForRenderUpdate(pos, pos);
		markDirty();
	}

	public void removePlaceTorches() {
		PLACE_TORCH = 0;
		IBlockState state = world.getBlockState(pos);
		world.markBlockRangeForRenderUpdate(pos, pos);
		markDirty();
	}

	public void addBlock() {
		BLOCKS++;
		IBlockState state = world.getBlockState(pos);
		world.markBlockRangeForRenderUpdate(pos, pos);
		markDirty();
	}

	public void removeBlock() {
		BLOCKS--;
		IBlockState state = world.getBlockState(pos);
		world.markBlockRangeForRenderUpdate(pos, pos);
		markDirty();
	}

	public void setActivated(boolean active) {
		ACTIVATED = active;
		markDirty();
		IBlockState state = world.getBlockState(pos);
		world.markBlockRangeForRenderUpdate(pos, pos);
		world.notifyBlockUpdate(pos, state, state, 3);
		world.scheduleBlockUpdate(pos, getBlockType(), 0, 0);
	}

	public void addTick() {
		TICKS++;
		markDirty();
		IBlockState state = world.getBlockState(pos);
		world.markBlockRangeForRenderUpdate(pos, pos);
	}

	public void removeTicks() {
		TICKS = 0;
		markDirty();
		IBlockState state = world.getBlockState(pos);
		world.markBlockRangeForRenderUpdate(pos, pos);
	}

	public void toggleDrawLine() {
		DRAW_LINE = !DRAW_LINE;
		System.out.println(DRAW_LINE);
		markDirty();
		IBlockState state = world.getBlockState(pos);
		world.markBlockRangeForRenderUpdate(pos, pos);
	}

	public void setLinePos(BlockPos pos) {
		BEGIN_LINE_POS = pos;
		DRAW_LINE_X = pos.getX();
		DRAW_LINE_Y = pos.getY();
		DRAW_LINE_Z = pos.getZ();
		markDirty();
		IBlockState state = world.getBlockState(pos);
		world.markBlockRangeForRenderUpdate(pos, pos);
	}

	@Override
	public NBTTagCompound writeToNBT(NBTTagCompound compound) {
		super.writeToNBT(compound);
		compound.setInteger("FuelAmount", FUEL_AMOUNT);
		compound.setBoolean("Activated", ACTIVATED);
		compound.setInteger("Ticks", TICKS);
		compound.setInteger("Torches", TORCHES);
		compound.setInteger("PlaceTorch", PLACE_TORCH);
		compound.setInteger("Blocks", BLOCKS);
		compound.setBoolean("DrawLine", DRAW_LINE);
		compound.setInteger("PosX", DRAW_LINE_X);
		compound.setInteger("PosY", DRAW_LINE_Y);
		compound.setInteger("PosZ", DRAW_LINE_Z);
		return compound;
	}

	@Override
	public void readFromNBT(NBTTagCompound compound) {
		super.readFromNBT(compound);
		FUEL_AMOUNT = compound.getInteger("FuelAmount");
		ACTIVATED = compound.getBoolean("Activated");
		TICKS = compound.getInteger("Ticks");
		TORCHES = compound.getInteger("Torches");
		PLACE_TORCH = compound.getInteger("PlaceTorch");
		BLOCKS = compound.getInteger("Blocks");
		DRAW_LINE = compound.getBoolean("DrawLine");
		DRAW_LINE_X = compound.getInteger("PosX");
		DRAW_LINE_Y = compound.getInteger("PosY");
		DRAW_LINE_Z = compound.getInteger("PosZ");
		BEGIN_LINE_POS = new BlockPos(DRAW_LINE_X, DRAW_LINE_Y, DRAW_LINE_Z);
	}

	@Override
	public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity pkt) {
		super.onDataPacket(net, pkt);
		handleUpdateTag(pkt.getNbtCompound());
	}

	@Override
	public SPacketUpdateTileEntity getUpdatePacket() {
		return new SPacketUpdateTileEntity(pos, 3, getUpdateTag());
	}

	@Override
	public NBTTagCompound getUpdateTag() {
		return writeToNBT(new NBTTagCompound());
	}

	@Override
	public void update() {
		if (ACTIVATED) {
			addTick();
			UPDATE = true;
			removeFuel();
			if (FUEL_AMOUNT <= 0) {
				FUEL_AMOUNT = 0;
				setActivated(false);
				markDirty();
			}
			if (TICKS == 20) {
				if (!world.isRemote) {
					EnumFacing facing = world.getBlockState(pos).getValue(BlockAutoMiner.FACING);
					EnumFacing facingL = facing.rotateYCCW();
					EnumFacing facingR = facing.rotateY();
					Random random = new Random();

					BlockPos positionC = pos.offset(world.getBlockState(pos).getValue(BlockAutoMiner.FACING));
					BlockPos positionL = positionC.offset(facingL);
					BlockPos positionR = positionC.offset(facingR);
					BlockPos positionCU = positionC.up();
					BlockPos positionLU = positionL.up();
					BlockPos positionRU = positionR.up();
					BlockPos positionCUU = positionCU.up();
					BlockPos positionLUU = positionLU.up();
					BlockPos positionRUU = positionRU.up();

					IBlockState stateC = world.getBlockState(positionC);
					IBlockState stateL = world.getBlockState(positionL);
					IBlockState stateR = world.getBlockState(positionR);
					IBlockState stateCU = world.getBlockState(positionCU);
					IBlockState stateLU = world.getBlockState(positionLU);
					IBlockState stateRU = world.getBlockState(positionRU);
					IBlockState stateCUU = world.getBlockState(positionCUU);
					IBlockState stateLUU = world.getBlockState(positionLUU);
					IBlockState stateRUU = world.getBlockState(positionRUU);

					List<ItemStack> stackC = stateC.getBlock().getDrops(world, positionC, stateC, 0);
					List<ItemStack> stackL = stateL.getBlock().getDrops(world, positionL, stateL, 0);
					List<ItemStack> stackR = stateR.getBlock().getDrops(world, positionR, stateR, 0);
					List<ItemStack> stackCU = stateCU.getBlock().getDrops(world, positionCU, stateCU, 0);
					List<ItemStack> stackLU = stateLU.getBlock().getDrops(world, positionLU, stateLU, 0);
					List<ItemStack> stackRU = stateRU.getBlock().getDrops(world, positionRU, stateRU, 0);
					List<ItemStack> stackCUU = stateCUU.getBlock().getDrops(world, positionCUU, stateCUU, 0);
					List<ItemStack> stackLUU = stateLUU.getBlock().getDrops(world, positionLUU, stateLUU, 0);
					List<ItemStack> stackRUU = stateRUU.getBlock().getDrops(world, positionRUU, stateRUU, 0);

					dropItems(stackC, stateC, positionC);
					dropItems(stackL, stateL, positionL);
					dropItems(stackR, stateR, positionR);
					dropItems(stackCU, stateCU, positionCU);
					dropItems(stackLU, stateLU, positionLU);
					dropItems(stackRU, stateRU, positionRU);
					dropItems(stackCUU, stateCUU, positionCUU);
					dropItems(stackLUU, stateLUU, positionLUU);
					dropItems(stackRUU, stateRUU, positionRUU);

					setBlockToAir(stateC, positionC);
					setBlockToAir(stateL, positionL);
					setBlockToAir(stateR, positionR);
					setBlockToAir(stateCU, positionCU);
					setBlockToAir(stateLU, positionLU);
					setBlockToAir(stateRU, positionRU);
					setBlockToAir(stateCUU, positionCUU);
					setBlockToAir(stateLUU, positionLUU);
					setBlockToAir(stateRUU, positionRUU);

					if ((TORCHES >= 2) && (PLACE_TORCH >= 6)) {
						BlockPos positionLLU = positionLU.offset(facingL);
						BlockPos positionRRU = positionRU.offset(facingR);

						if (world.getBlockState(positionLLU).isSideSolid(world, positionLLU, facingR)
								&& (world.getBlockState(positionLU).getMaterial() == Material.AIR)) {
							if (world.setBlockState(positionLU,
									Blocks.TORCH.getDefaultState().withProperty(BlockTorch.FACING, facingR))) {
								removeTorches(1);
								removePlaceTorches();
							}
						}
						if (world.getBlockState(positionRRU).isSideSolid(world, positionRRU, facingL)
								&& (world.getBlockState(positionRU).getMaterial() == Material.AIR)) {
							if (world.setBlockState(positionRU,
									Blocks.TORCH.getDefaultState().withProperty(BlockTorch.FACING, facingL))) {
								removeTorches(1);
								removePlaceTorches();
							}
						}
					} else {
						addPlaceTorch();
					}

					BlockPos positionD = positionC.down();
					IBlockState stateD = world.getBlockState(positionD);
					if (BLOCKS > 0) {
						if (!stateD.isTopSolid()) {
							world.setBlockState(positionD, Blocks.COBBLESTONE.getDefaultState());
							removeBlock();
						}
					} else {
						if (!stateD.isTopSolid()) {
							setActivated(false);
							removeTicks();
						}
					}
					if (!world.getBlockState(pos.down()).isTopSolid()) {
						setActivated(false);
						removeTicks();
					}
					if (world.getBlockState(positionC).getMaterial().isSolid()) {
						setActivated(false);
						removeTicks();
					}
				}
			}
			if (TICKS == 40) {
				if (!world.isRemote) {
					BlockPos position = pos.offset(world.getBlockState(pos).getValue(BlockAutoMiner.FACING));
					BlockPos position1 = pos;
					world.setBlockState(position, world.getBlockState(pos));
					TileEntityAutoMiner te = new TileEntityAutoMiner();
					te.ACTIVATED = ACTIVATED;
					te.FUEL_AMOUNT = FUEL_AMOUNT;
					te.TICKS = TICKS;
					te.UPDATE = UPDATE;
					te.TORCHES = TORCHES;
					te.PLACE_TORCH = PLACE_TORCH;
					te.BLOCKS = BLOCKS;
					te.BEGIN_LINE_POS = BEGIN_LINE_POS;
					te.DRAW_LINE = DRAW_LINE;
					te.DRAW_LINE_X = DRAW_LINE_X;
					te.DRAW_LINE_Y = DRAW_LINE_Y;
					te.DRAW_LINE_Z = DRAW_LINE_Z;
					ACTIVATED = false;
					TICKS = 0;
					UPDATE = false;
					TORCHES = 0;
					PLACE_TORCH = 0;
					BLOCKS = 0;
					BEGIN_LINE_POS = new BlockPos(0, 0, 0);
					DRAW_LINE = false;
					DRAW_LINE_X = 0;
					DRAW_LINE_Y = 0;
					DRAW_LINE_Z = 0;
					world.setTileEntity(position, te);
					world.setBlockToAir(position1);
				}
			}
		} else {
			if (UPDATE) {
				IBlockState state = world.getBlockState(pos);
				world.markBlockRangeForRenderUpdate(pos, pos);
			}
			UPDATE = false;
		}
		if (TICKS >= 40) {
			removeTicks();
		}	
	}

	private void dropItems(List<ItemStack> stackList, IBlockState state, BlockPos pos) {
		for (int i = 0; i < stackList.size(); i++) {
			ItemStack stack = stackList.get(i);
			if ((stack.getItem() instanceof ItemBlock)
					&& ((Block.getBlockFromItem(stack.getItem()).getBlockHardness(state, world, pos) < 0F)
							|| (Block.getBlockFromItem(stack.getItem()).getBlockHardness(state, world, pos) > 30F))) {
				continue;
			}
			world.spawnEntity(new EntityItem(world, pos.getX(), pos.getY() + 1, pos.getZ(), stack));
		}
	}

	private void setBlockToAir(IBlockState state, BlockPos pos) {
		if (!(state.getBlockHardness(world, pos) > 30F) && !(state.getBlockHardness(world, pos) < 0F)) {
			world.setBlockToAir(pos);
		}
	}
}

TESR.

public class TESRAutoMiner extends TileEntitySpecialRenderer<TileEntityAutoMiner> {

	@Override
	public void render(TileEntityAutoMiner te, double x, double y, double z, float partialTicks, int destroyStage,
			float alpha) {
		super.render(te, x, y, z, partialTicks, destroyStage, alpha);
		if (te.DRAW_LINE) {
			GL11.glPushMatrix();
			GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
			GL11.glTranslated(-te.getPos().getX(), -te.getPos().getY(), -te.getPos().getZ());
			GL11.glDisable(GL11.GL_LIGHTING);
			GL11.glDisable(GL11.GL_TEXTURE_2D);
			drawLine(new Vec3d(te.DRAW_LINE_X, te.DRAW_LINE_Y, te.DRAW_LINE_Z), new Vec3d(te.getPos()));
			GL11.glPopAttrib();
			GL11.glPopMatrix();
		}
	}

	private void drawLine(Vec3d blockA, Vec3d blockB) {
		Tessellator tess = Tessellator.getInstance();
		BufferBuilder buff = tess.getBuffer();
		blockB.addVector(0, 1, 0);
		blockB.addVector(0, -1, 0);
		blockA.addVector(0, -0.02f, 0);
		buff.begin(7, DefaultVertexFormats.POSITION_COLOR);
		buff.color(0F, 1F, 1F, 1F);

		Vec3d recLong = blockA.subtract(blockB);
		Vec3d perpendicular = Vec3d.fromPitchYaw(1.0F, 1.0F);
		perpendicular = perpendicular.normalize();

		float Width = 1f / 16f;

		Vec3d R1 = blockA.subtract(blockB);
		Vec3d R2 = blockA.subtract(blockB);
		Vec3d R3 = blockA.subtract(blockB);
		Vec3d R4 = blockA.subtract(blockB);

		R1.addVector(blockA.x + perpendicular.x * Width, 0, 0);
		R1.addVector(0, 0, blockA.z + perpendicular.z * Width);
		R2.addVector(blockA.x - perpendicular.x * Width, 0, 0);
		R2.addVector(0, 0, blockA.z - perpendicular.z * Width);
		R1.addVector(0, blockA.y - 0.01, 0);
		R2.addVector(0, blockA.y - 0.01, 0);

		R3.addVector(blockB.x + perpendicular.x * Width, 0, 0);
		R3.addVector(0, 0, blockB.z + perpendicular.z * Width);
		R4.addVector(blockB.x - perpendicular.x * Width, 0, 0);
		R4.addVector(0, 0, blockB.z - perpendicular.z * Width);
		R3.addVector(0, blockB.y + 0.75, 0);
		R4.addVector(0, blockB.y + 0.75, 0);

		int[] a = { (int) (R1.x + 0.5), (int) R1.y, (int) (R1.z + 0.5) };
		int[] b = { (int) (R3.x + 0.5), (int) R3.y, (int) (R3.z + 0.5) };
		int[] c = { (int) (R4.x + 0.5), (int) R4.y, (int) (R4.z + 0.5) };
		int[] d = { (int) (R2.x + 0.5), (int) R2.y, (int) (R2.z + 0.5) };

		buff.addVertexData(a);
		buff.addVertexData(b);
		buff.addVertexData(c);
		buff.addVertexData(d);

		tess.draw();
	}

}

 

Classes: 94

Lines of code: 12173

Other files: 206

Github repo: https://github.com/KokkieBeer/DeGeweldigeMod

Posted

 

31 minutes ago, Kokkie said:

GL11

Do not use GL11 methods directly. Use GlStateManager. Using GL directly messes up with GlStateManager's flags and can screw some things up.

 

32 minutes ago, Kokkie said:

GL11.glTranslated(-te.getPos().getX(), -te.getPos().getY(), -te.getPos().getZ());

Why are you offsetting the matrix by TE's negative position? That is not a good idea, there is a reason these

33 minutes ago, Kokkie said:

double x, double y, double z

parameters exist. They are used as your render coordinates. Use them.

 

34 minutes ago, Kokkie said:

GL11.glPushAttrib(GL11.GL_ENABLE_BIT);

Why?

 

34 minutes ago, Kokkie said:

buff.begin(7, DefaultVertexFormats.POSITION_COLOR);

7 is GL_QUADS. If you are drawing a line GL_LINES(1) makes much more sense.

 

35 minutes ago, Kokkie said:

buff.addVertexData(a);

This adds raw data to the buffer. Unless you know how to use this you should not be doing that. Use BufferBuilder::pos to specify position, BufferBuilder::color to specify color and BufferBuilder::endVertex to end the current vertex data.

 

Vec3d start = new Vec3d(te.getPos().getX(), te.getPos().getY(), te.getPos().getZ());
Vec3d end = start.addVector(0, 10, 0);
Vec3d posDiff = end.subtract(start);
GlStateManager.pushMatrix();
GlStateManager.glLineWidth(1F);
GlStateManager.disableTexture2D();
BufferBuilder bb = Tessellator.getInstance().getBuffer();
bb.begin(GL11.GL_LINES, DefaultVertexFormats.POSITION_COLOR);
bb.pos(x, y, z).color(1, 1, 1, 1F).endVertex();
bb.pos(posDiff.x, posDiff.y, posDiff.z).color(1, 1, 1, 1F).endVertex();
Tessellator.getInstance().draw();
GlStateManager.enableTexture2D();
GlStateManager.popMatrix();

This is a super-quick(and a bit messy) example that draws the line in 4! calls 2 of which are begin and draw calls. Everything above and below are gl setups/state restoring. I could've even dropped push/pop matrix here as I am not doing anything with the matrix.

 

If you need something more complex than a simple GL line(a line with a texture, more controllable line, rotating line, etc) I suggest you to look at vanilla examples like TileEntityBeaconRenderer or RenderGuardian. The later will need to be adapted to be a TESR but will work just fine.

Posted
1 hour ago, V0idWa1k3r said:

7 is GL_QUADS. If you are drawing a line GL_LINES(1) makes much more sense.

GL_LINES are 1 pixel thick lines (and may not render at all). Quads is better.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted (edited)
11 minutes ago, Draco18s said:

GL_LINES are 1 pixel thick lines (and may not render at all). Quads is better.

You can specify the width of the line with GlStateManager::glLineWidth. Quads are better for more control over the rendering process, as they are quads and can be positioned/rotated/textured as you wish, but lines work just fine for simple things. For example vanilla uses LINE_STRIP(which is a variation GL_LINES) do draw the bounding box over the block you are looking at and it works perfect. Lines and quads are just used for different purposes ;)

 

29 minutes ago, Kokkie said:

Thanks, but now how do I change the pos it draws the line to (from the te pos)?

You calculate the vector that points from your TE to the point you want the line to go to and use your start vector + that vector as your end coordinates.

 

Edited by V0idWa1k3r
Posted
23 minutes ago, V0idWa1k3r said:

You can specify the width of the line with GlStateManager::glLineWidth. Quads are better for more control over the rendering process, as they are quads and can be positioned/rotated/textured as you wish, but lines work just fine for simple things. For example vanilla uses LINE_STRIP(which is a variation GL_LINES) do draw the bounding box over the block you are looking at and it works perfect. Lines and quads are just used for different purposes ;)

I've had problems with it in the past, mainly by either not rendering anything at all, or by ignoring the line width specified.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

Why wouldn't this work?

			Vec3d start = new Vec3d(te.getPos());
			Vec3d end = new Vec3d(te.BEGIN_LINE_POS);
			GlStateManager.disableTexture2D();
			BufferBuilder bb = Tessellator.getInstance().getBuffer();
			bb.begin(GL11.GL_LINE_STRIP, DefaultVertexFormats.POSITION_COLOR);
			bb.pos(start.x + 0.5, start.y + 0.5, start.z + 0.5).color(0, 1, 1, 1F).endVertex();
			bb.pos(end.x, end.y, end.z).color(0, 1, 1, 1F).endVertex();
			Tessellator.getInstance().draw();
			GlStateManager.enableTexture2D();

Can someone explain?

Classes: 94

Lines of code: 12173

Other files: 206

Github repo: https://github.com/KokkieBeer/DeGeweldigeMod

Posted (edited)

You are still using your TE's positions as the start of the drawing vector. Use the x/y/z parameters from the draw method.

Your end vector must be a drawing start vector + delta vector of your TE's position and the end position of the line. If your line goes 10 blocks up from your TE it will be [x + 0, y + 10, z + 0]. 

Edited by V0idWa1k3r
Posted (edited)

So.. This?

			Vec3i start = new Vec3i(x, y, z);
			Vec3d end = new Vec3d(te.BEGIN_LINE_POS.subtract(start));
			GlStateManager.disableTexture2D();
			BufferBuilder bb = Tessellator.getInstance().getBuffer();
			bb.begin(GL11.GL_LINE_STRIP, DefaultVertexFormats.POSITION_COLOR);
			bb.pos(x + 0.5, y + 0.5, z + 0.5).color(0, 1, 1, 1F).endVertex();
			bb.pos(end.x + 0.5, end.y + 0.5, end.z + 0.5).color(0, 1, 1, 1F).endVertex();
			Tessellator.getInstance().draw();
			GlStateManager.enableTexture2D();

It for some reason draws a line from the block to a random place...

Edited by Kokkie

Classes: 94

Lines of code: 12173

Other files: 206

Github repo: https://github.com/KokkieBeer/DeGeweldigeMod

Posted

Almost. 

13 minutes ago, Kokkie said:

Vec3d end = new Vec3d(te.BEGIN_LINE_POS.subtract(start));

You should not subtract the start vector as the start vector is the start of the line for rendering. Subtract your TE's position instead - that is the logical start of your line. 

Posted (edited)

Changed it to this.

			Vec3d start = new Vec3d(x, y, z);
			Vec3d end = new Vec3d(te.BEGIN_LINE_POS.subtract(te.getPos()));
			GlStateManager.disableTexture2D();
			BufferBuilder bb = Tessellator.getInstance().getBuffer();
			bb.begin(GL11.GL_LINE_STRIP, DefaultVertexFormats.POSITION_COLOR);
			bb.pos(x + 0.5, y + 0.5, z + 0.5).color(0, 1, 1, 1F).endVertex();
			bb.pos(end.x + 0.5, end.y + 0.5, end.z + 0.5).color(0, 1, 1, 1F).endVertex();
			Tessellator.getInstance().draw();
			GlStateManager.enableTexture2D();

Doesn't work.

Edited by Kokkie

Classes: 94

Lines of code: 12173

Other files: 206

Github repo: https://github.com/KokkieBeer/DeGeweldigeMod

Posted (edited)

Looks correct. What is 

8 minutes ago, Kokkie said:

te.BEGIN_LINE_POS

? Is it pointing to fixed coordinates in the world? Is it being synced to the client?

8 minutes ago, Kokkie said:

new Vec3d(te.BEGIN_LINE_POS.subtract(te.getPos()));

=>

te.BEGIN_LINE_POS.subtract(te.getPos()); Vec3d::subtract already returns a new Vec3d object.

 

EDIT: there was an issue in my example. This line:

bb.pos(posDiff.x, posDiff.y, posDiff.z).color(1, 1, 1, 1F).endVertex();

is supposed to be

bb.pos(x + posDiff.x, y + posDiff.y, z + posDiff.z).color(1, 1, 1, 1F).endVertex();

As you need to specify the end position relative to render coordinates aswell, my bad. Change that line in your code too and it 'should' work provided that everything else is correct.

Edited by V0idWa1k3r
Posted

So, now I want to add a block outline of where it used to be, but it doesn't, also the line doesn't work anymore either.

public class TESRAutoMiner extends TileEntitySpecialRenderer<TileEntityAutoMiner> {
	@Override
	public void render(TileEntityAutoMiner te, double x, double y, double z, float partialTicks, int destroyStage,
			float alpha) {
		if (te.DRAW_LINE) {
			BlockPos pos = new BlockPos(x, y, z);
			AMUtils.drawLineMiddle(te.getPos(), te.BEGIN_LINE_POS, pos);
			AMUtils.drawBox(te.BEGIN_LINE_POS, pos);
		}
	}
}
public class AMUtils {
	public static void drawLineMiddle(BlockPos start, BlockPos end, BlockPos pos) {
		BlockPos start1 = start.add(0.5, 0.5, 0.5);
		BlockPos end1 = end.add(0.5, 0.5, 0.5);
		drawLine(start1, end1, pos);
	}

	private static void drawLine(BlockPos start, BlockPos end, BlockPos pos) {
		Vec3d start1 = new Vec3d(start);
		Vec3d end1 = new Vec3d(end);
		Vec3d posDiff = end1.subtract(start1);
		GlStateManager.pushMatrix();
		GlStateManager.glLineWidth(2F);
		GlStateManager.disableTexture2D();
		GlStateManager.disableLighting();
		BufferBuilder bb = Tessellator.getInstance().getBuffer();
		bb.begin(GL11.GL_LINES, DefaultVertexFormats.POSITION_COLOR);
		bb.pos(pos.getX(), pos.getY(), pos.getZ()).color(0, 1, 0, 1F).endVertex();
		bb.pos(pos.getX() + posDiff.x, pos.getY() + posDiff.y, pos.getZ() + posDiff.z).color(0, 1, 0, 1F).endVertex();
		Tessellator.getInstance().draw();
		GlStateManager.enableLighting();
		GlStateManager.enableTexture2D();
		GlStateManager.popMatrix();
	}

	public static void drawBox(BlockPos block, BlockPos pos) {
		drawLine(block, block.add(1, 0, 0), pos);
		drawLine(block, block.add(0, 1, 0), pos);
		drawLine(block, block.add(0, 0, 1), pos);
		
		drawLine(block.add(1, 0, 0), block.add(1, 1, 0), pos);
		drawLine(block.add(1, 0, 0), block.add(1, 0, 1), pos);
		
		drawLine(block.add(0, 1, 0), block.add(1, 1, 0), pos);
		drawLine(block.add(0, 1, 0), block.add(0, 1, 1), pos);
		
		drawLine(block.add(0, 0, 1), block.add(1, 0, 1), pos);
		drawLine(block.add(0, 0, 1), block.add(0, 1, 1), pos);
		
		drawLine(block.add(1, 1, 0), block.add(1, 1, 1), pos);
		drawLine(block.add(1, 0, 1), block.add(1, 1, 1), pos);
		drawLine(block.add(0, 1, 1), block.add(1, 1, 1), pos);
	}
}

 

Classes: 94

Lines of code: 12173

Other files: 206

Github repo: https://github.com/KokkieBeer/DeGeweldigeMod

Posted
1 minute ago, Kokkie said:

BlockPos pos = new BlockPos(x, y, z);

You can't pass the x/y/z like that. BlockPos rounds anything you pass to it to an integer. For rendering the double precision matters.

If you want to render an outline around a block I recommend not reinventing the wheel and seeing how vanilla does it at RenderGlobal::drawSelectionBoundingBox/RenderGlobal::drawBoundingBox. That method even is public so you can just offset the matrix/BufferBuilder, call it and you are done.

I would also recommend debugging if your methods are called at all. 

Posted

I now have this.

public class TESRAutoMiner extends TileEntitySpecialRenderer<TileEntityAutoMiner> {
	@Override
	public void render(TileEntityAutoMiner te, double x, double y, double z, float partialTicks, int destroyStage,
			float alpha) {
		if (te.DRAW_LINE) {
			AMUtils.drawLineMiddle(te.getPos(), te.BEGIN_LINE_POS, x, y, z);
			AMUtils.drawBox(te.BEGIN_LINE_POS, x, y, z);
		}
	}
	
	@Override
	public boolean isGlobalRenderer(TileEntityAutoMiner te) {
		return true;
	}
}
public class AMUtils {
	public static void drawLineMiddle(BlockPos start, BlockPos end, double x, double y, double z) {
		drawLine(start, end, x + 0.5, y + 0.5, z + 0.5);
	}

	private static void drawLine(BlockPos start, BlockPos end, double x, double y, double z) {
		Vec3d start1 = new Vec3d(start);
		Vec3d end1 = new Vec3d(end);
		Vec3d posDiff = end1.subtract(start1);
		GlStateManager.pushMatrix();
		GlStateManager.glLineWidth(2F);
		GlStateManager.disableTexture2D();
		GlStateManager.disableLighting();
		BufferBuilder bb = Tessellator.getInstance().getBuffer();
		bb.begin(GL11.GL_LINES, DefaultVertexFormats.POSITION_COLOR);
		bb.pos(x, y, z).color(1, 0, 0, 1F).endVertex();
		bb.pos(x + posDiff.x, y + posDiff.y, z + posDiff.z).color(1, 0, 0, 1F).endVertex();
		Tessellator.getInstance().draw();
		GlStateManager.enableLighting();
		GlStateManager.enableTexture2D();
		GlStateManager.popMatrix();
	}

	public static void drawBox(BlockPos block, double x, double y, double z) {
		double minX = block.getX();
		double minY = block.getY();
		double minZ = block.getZ();
		double maxX = block.getX() + 1;
		double maxY = block.getY() + 1;
		double maxZ = block.getZ() + 1;
		GlStateManager.enableBlend();
        GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
        GlStateManager.glLineWidth(2.0F);
        GlStateManager.disableTexture2D();
        GlStateManager.depthMask(false);
		RenderGlobal.drawBoundingBox(minX, minY, minZ, maxX, maxY, maxZ, 1, 0, 0, 1);
        GlStateManager.depthMask(true);
        GlStateManager.enableTexture2D();
        GlStateManager.disableBlend();
	}
}

It renders the line, but doesn't render the box.

Classes: 94

Lines of code: 12173

Other files: 206

Github repo: https://github.com/KokkieBeer/DeGeweldigeMod

Posted

Before drawing the box using RenderGlobal's method you must offset your BufferBuilder or GL's matrix to where you actually want to render the box at. RenderGlobal renders a [minX, minY, minZ] to [maxX, maxY, maxZ] box. You are currently offseting by x/y/z of the BlockPos in the world, and you must offset by render x/y/z + delta vector of the BlockPos in the world and your TE's pos, similar to how you draw a line. 

Posted

I've sort of got it working, it only draws 4 lines instead of 12... Only the top Z lines and bottom X lines.

public class TESRAutoMiner extends TileEntitySpecialRenderer<TileEntityAutoMiner> {
	@Override
	public void render(TileEntityAutoMiner te, double x, double y, double z, float partialTicks, int destroyStage,
			float alpha) {
		if (te.DRAW_LINE) {
			AMUtils.drawLineMiddle(te.getPos(), te.BEGIN_LINE_POS, x, y, z);
			AMUtils.drawBox(te.getPos(), te.BEGIN_LINE_POS, x, y, z);
		}
	}
	
	@Override
	public boolean isGlobalRenderer(TileEntityAutoMiner te) {
		return true;
	}
}
public class AMUtils {
	public static void drawLineMiddle(BlockPos start, BlockPos end, double x, double y, double z) {
		drawLine(start, end, x + 0.5, y + 0.5, z + 0.5);
	}

	private static void drawLine(BlockPos start, BlockPos end, double x, double y, double z) {
		Vec3d start1 = new Vec3d(start);
		Vec3d end1 = new Vec3d(end);
		Vec3d posDiff = end1.subtract(start1);
		GlStateManager.pushMatrix();
		GlStateManager.glLineWidth(2F);
		GlStateManager.disableTexture2D();
		GlStateManager.disableLighting();
		BufferBuilder bb = Tessellator.getInstance().getBuffer();
		bb.begin(GL11.GL_LINES, DefaultVertexFormats.POSITION_COLOR);
		bb.pos(x, y, z).color(1, 0, 0, 1F).endVertex();
		bb.pos(x + posDiff.x, y + posDiff.y, z + posDiff.z).color(1, 0, 0, 1F).endVertex();
		Tessellator.getInstance().draw();
		GlStateManager.enableLighting();
		GlStateManager.enableTexture2D();
		GlStateManager.popMatrix();
	}

	public static void drawBox(BlockPos start, BlockPos end, double x, double y, double z) {
		Vec3d start1 = new Vec3d(start);
		Vec3d end1 = new Vec3d(end);
		Vec3d posDiff = end1.subtract(start1);
		double minX = x + posDiff.x;
		double minY = y + posDiff.y;
		double minZ = z + posDiff.z;
		double maxX = x + posDiff.x + 1;
		double maxY = y + posDiff.y + 1;
		double maxZ = z + posDiff.z + 1;
		GlStateManager.pushMatrix();
		GlStateManager.glLineWidth(2F);
		GlStateManager.disableTexture2D();
		GlStateManager.disableLighting();
		BufferBuilder bb = Tessellator.getInstance().getBuffer();
		bb.begin(GL11.GL_LINES, DefaultVertexFormats.POSITION_COLOR);
		RenderGlobal.drawBoundingBox(bb, minX, minY, minZ, maxX, maxY, maxZ, 1, 0, 0, 1);
		Tessellator.getInstance().draw();
		GlStateManager.enableLighting();
		GlStateManager.enableTexture2D();
		GlStateManager.popMatrix();
	}
}

Also, how can I make it so it renders even if you can't see the block, like beacons?

Classes: 94

Lines of code: 12173

Other files: 206

Github repo: https://github.com/KokkieBeer/DeGeweldigeMod

Posted
2 minutes ago, Kokkie said:

bb.begin(GL11.GL_LINES, DefaultVertexFormats.POSITION_COLOR);

If you look at RenderGlobal::drawBoundingBox method you will see that it uses a different GL mode of 3, which is GL_LINE_STRIP. The difference is that LINES requires you to specify a beginning an an end for each new line you draw, where LINE_STRIP assumes that the end of the last line is the beginning of the new one. You are not using the correct GL mode here.

 

4 minutes ago, Kokkie said:

Also, how can I make it so it renders even if you can't see the block, like beacons?

You know they say that a good question already contains an answer? This is one very good question. You know that there is a block in game that does X. The next logical step - lookup how it does X in it's code. In your case you need to override TileEntity::getRenderBoundingBox and possibly TileEntity::getMaxRenderDistanceSquared if you want your tile to be drawn more than 64 blocks away.

Posted

This is something you will need to use QUADS for. You need to specify 4 vertices per quad(4 corners) and 6 quads(faces) make up a cube if positioned correctly. The ordering(CW vs CCW) also matters. You might need to experiment with it a bit to get the desired results. Vanilla uses models to abstract from direct rendering so I can't quite provide an example of direct rendering here.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Can anyone help me? I play in singleplayer with mods This is the crashlog: https://pastebin.com/C54MVSUr
    • Looks like supplementaries is conflicting with the mod spawn
    • ---- Minecraft Crash Report ---- // There are four lights! Time: 2024-11-26 09:45:49 Description: Exception in server tick loop net.mehvahdjukaar.supplementaries.common.utils.VibeChecker$BadModError: Some OTHER mod loaded the Sheets class to early, causing modded banner patterns and sherds textures to not include modded ones. Refusing to proceed further. Missing entries: [ResourceKey[minecraft:decorated_pot_patterns / spawn:crown_pottery_pattern], ResourceKey[minecraft:decorated_pot_patterns / spawn:spade_pottery_pattern]] (mods listed here are NOT the cause of this, merely the ones that got broken because of it) Check previous forge log lines to find the offending mod.     at knot//net.mehvahdjukaar.supplementaries.common.utils.VibeChecker.clientStuff(VibeChecker.java:100)     at knot//net.mehvahdjukaar.supplementaries.common.utils.VibeChecker.checkVibe(VibeChecker.java:42)     at knot//net.mehvahdjukaar.supplementaries.common.events.ServerEvents.onPlayerLoggedIn(ServerEvents.java:121)     at knot//net.mehvahdjukaar.supplementaries.common.events.fabric.ServerEventsFabric.lambda$init$0(ServerEventsFabric.java:40)     at knot//net.fabricmc.fabric.api.networking.v1.ServerPlayConnectionEvents.lambda$static$2(ServerPlayConnectionEvents.java:48)     at knot//net.fabricmc.fabric.impl.networking.server.ServerPlayNetworkAddon.onClientReady(ServerPlayNetworkAddon.java:66)     at knot//net.minecraft.class_3324.handler$dnm001$fabric-networking-api-v1$handlePlayerConnection(class_3324.java:10018)     at knot//net.minecraft.class_3324.method_14570(class_3324.java:215)     at knot//net.minecraft.class_3248.method_33800(class_3248.java:131)     at knot//net.minecraft.class_3248.method_14384(class_3248.java:118)     at knot//net.minecraft.class_3248.redirect$dnn000$fabric-networking-api-v1$handlePlayerJoin(class_3248.java:563)     at knot//net.minecraft.class_3248.method_18784(class_3248.java:68)     at knot//net.minecraft.class_2535.method_10754(class_2535.java:259)     at knot//net.minecraft.class_3242.method_14357(class_3242.java:172)     at knot//net.minecraft.server.MinecraftServer.method_3813(MinecraftServer.java:908)     at knot//net.minecraft.server.MinecraftServer.method_3748(MinecraftServer.java:824)     at knot//net.minecraft.class_1132.method_3748(class_1132.java:105)     at knot//net.minecraft.server.MinecraftServer.method_29741(MinecraftServer.java:671)     at knot//net.minecraft.server.MinecraftServer.method_29739(MinecraftServer.java:265)     at java.base/java.lang.Thread.run(Unknown Source) A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- System Details -- Details:     Minecraft Version: 1.20.1     Minecraft Version ID: 1.20.1     Operating System: Windows 10 (amd64) version 10.0     Java Version: 17.0.12, Azul Systems, Inc.     Java VM Version: OpenJDK 64-Bit Server VM (mixed mode, sharing), Azul Systems, Inc.     Memory: 6718697432 bytes (6407 MiB) / 11031019520 bytes (10520 MiB) up to 17179869184 bytes (16384 MiB)     CPUs: 12     Processor Vendor: GenuineIntel     Processor Name: Intel(R) Core(TM) i7-3930K CPU @ 3.20GHz     Identifier: Intel64 Family 6 Model 45 Stepping 7     Microarchitecture: Sandy Bridge (Server)     Frequency (GHz): 3.20     Number of physical packages: 1     Number of physical CPUs: 6     Number of logical CPUs: 12     Graphics card #0 name: NVIDIA GeForce GTX 1070     Graphics card #0 vendor: NVIDIA (0x10de)     Graphics card #0 VRAM (MB): 4095.00     Graphics card #0 deviceId: 0x1b81     Graphics card #0 versionInfo: DriverVersion=32.0.15.6614     Memory slot #0 capacity (MB): 8192.00     Memory slot #0 clockSpeed (GHz): 1.60     Memory slot #0 type: DDR3     Memory slot #1 capacity (MB): 8192.00     Memory slot #1 clockSpeed (GHz): 1.60     Memory slot #1 type: DDR3     Memory slot #2 capacity (MB): 8192.00     Memory slot #2 clockSpeed (GHz): 1.60     Memory slot #2 type: DDR3     Memory slot #3 capacity (MB): 8192.00     Memory slot #3 clockSpeed (GHz): 1.60     Memory slot #3 type: DDR3     Virtual memory max (MB): 37550.15     Virtual memory used (MB): 24472.94     Swap memory total (MB): 4864.00     Swap memory used (MB): 0.00     JVM Flags: 2 total; -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump -Xmx16384M     Fabric Mods:          additionz: AdditionZ 1.3.2         adorn: Adorn 5.0.1+1.20.1         advanced_runtime_resource_pack: Runtime Resource Pack 0.8.1         advancementsfullscreen: AdvancementsFullscreen 1.0         advancementssearch: AdvancementsSearch 1.0         adventurez: AdventureZ 1.4.20         agedaddition: Aged-Addition 1.0.6         alloy_forgery: Alloy Forgery 2.1.2+1.20         almanac: Almanac 1.0.2         amarite: Amarite 1.0.8             cardinal-components-base: Cardinal Components API (base) 5.2.2             cardinal-components-block: Cardinal Components API (blocks) 5.2.2             cardinal-components-entity: Cardinal Components API (entities) 5.2.2             reach-entity-attributes: Reach Entity Attributes 2.4.0         ambientenvironment: Ambient Environment 11.0.0.1         amendments: Amendments 1.20-1.2.12         another_furniture: Another Furniture 1.20.1-3.0.1         antique_atlas: Antique Atlas 2.10.0+1.20         appleskin: AppleSkin 2.5.1+mc1.20         architectury: Architectury 9.2.14         astrocraft: Astrocraft 1.4.5+1.20.1         asynclocator: Async Locator 1.3.0         athena: Athena 3.1.2         autotag-convention: AutoTag Convention 2.0.2+1.20             autotag: AutoTag 2.0.2+1.20         backslot: BackSlot 1.2.15             amecsapi: Amecs API 1.5.0+mc1.20-pre1         backslotaddon: BackSlot Addon 1.1.1         badoptimizations: BadOptimizations 2.2.0         bakery: [Let's Do] Bakery 2.0.3         balm-fabric: Balm 7.3.9             kuma_api: KumaAPI 20.1.8         bbb: Building But Better 1.20.1-fabric-1.0.2         betterarcheology: Better Archeology 1.2.1-1.20.1         bettercombat: Better Combat 1.8.6+1.20.1         betterdeserttemples: YUNG's Better Desert Temples 1.20-Fabric-3.0.3             org_reflections_reflections: reflections 0.10.2         betterendisland: YUNG's Better End Island 1.20-Fabric-2.0.6         betterfortresses: YUNG's Better Nether Fortresses 1.20-Fabric-2.0.6         betterjungletemples: YUNG's Better Jungle Temples 1.20-Fabric-2.0.5         betteroceanmonuments: YUNG's Better Ocean Monuments 1.20-Fabric-3.0.4         betterstats: Better Statistics Screen 3.12.6+fabric-1.20.1         bettertrims: BetterTrims 3.2.8         birds-boids: Birds Boids 1.1.0         blur: Blur (Fabric) 3.1.0             midnightlib: MidnightLib 1.4.1             satin: Satin 1.13.0         boids: Boids 1.2.2             blue_endless_jankson: jankson 1.2.3         bookshelf: Bookshelf 20.2.13         borderlessmining: Borderless Mining 1.1.8+1.20.1         brewery: [Let's Do] Brewery 2.0.3         cameraoverhaul: Camera Overhaul 1.4.1-fabric-universal         candlelight: [Let's Do] Candlelight 2.0.2         cardinal-components: Cardinal Components API 5.2.2             cardinal-components-chunk: Cardinal Components API (chunks) 5.2.2             cardinal-components-item: Cardinal Components API (items) 5.2.2             cardinal-components-level: Cardinal Components API (world saves) 5.2.2             cardinal-components-scoreboard: Cardinal Components API (scoreboard) 5.2.2             cardinal-components-world: Cardinal Components API (worlds) 5.2.2         cave_dweller: Cave Dweller 1.4.0         chalk: Chalk 2.2.4             com_github_mclegoman_releasetypeutils: releasetypeutils 2.1.0             fabric-simplelibs: Simple Fabric Libs 2.0.0         chalk-colorful-addon: Chalk: Colorful-Addon 2.1.1+1.19.3         chipped: Chipped 3.0.7         cloth-config: Cloth Config v11 11.1.136             cloth-basic-math: cloth-basic-math 0.6.1         collective: Collective 7.87         combatroll: Combat Roll 1.3.3+1.20.1         configurable: Configurable 2.2.3         connectiblechains: Connectible Chains 2.2.1+1.20.1         convenientdecor: Convenient Decor 0.4.3             omega-config: OmegaConfig 1.4.0+1.20.1         couplings: Couplings 1.9.5+1.20         craftedcore: CraftedCore 5.6         crawl: Crawl 0.12.0             mm: Manningham Mills 2.3         creeperoverhaul: Creeper Overhaul 3.0.2         crop_growth_modifier: Crop Growth Modifier 1.20.1-1.1.1         cyclepaintings: Cycle Paintings 3.6         darkpaintings: DarkPaintings 17.0.4         dawn: Dawn API 5.0.0             terraform-shapes-api-v1: Terraform Shapes API (v1) 7.0.1             terraform-wood-api-v1: Terraform Wood API (v1) 7.0.1         decorative_computers: decorative_computers 1.0.1         defaultoptions: Default Options 18.0.1         dehydration: Dehydration 1.3.6         desert_dungeon: Desert Dungeon 1.0.0         deuf_refabricated: DEUF Refabricated 1.1.0         distanthorizons: Distant Horizons 2.2.1-a         doapi: [Let's Do] API 1.2.15         dungeonnowloading: Dungeon Now Loading 1.5         dungeonz: DungeonZ 1.0.6         earlystage: EarlyStage 1.1.1         elytratrims: Elytra Trims 3.5.4             conditional-mixin: conditional mixin 0.6.2         elytratrims_extensions: Elytra Trims Extensions 2.2.1         emi: EMI 1.1.18+1.20.1+fabric         emi_enchanting: EMI Enchanting 0.1.2+1.20.1         emi_letsdo_compat: emi-letsdo-compat 1.3         emi_loot: EMI Loot 0.7.4+1.20.1+fabric         emi_ores: EMI Ores 1.0+1.20.1+fabric         emiffect: EMIffect 1.1.2+mc1.20.1         emitrades: EMI Trades 1.2.1+mc1.20.1             org_quiltmc_parsers_json: json 0.2.1         endermanoverhaul: Enderman Overhaul 1.0.4         endrem: End Remastered 5.2.4         entity_model_features: Entity Model Features 2.2.6         entity_texture_features: Entity Texture Features 6.2.7             org_apache_httpcomponents_httpmime: httpmime 4.5.10         entityculling: EntityCulling 1.7.1         environmentz: EnvironmentZ 2.0.8         euphonium: Euphonium 1.0.3+1.20             folk_sisby_kaleido-config: kaleido-config 0.3.1+1.3.2         everycomp: Every Compat 1.20-2.6.92         exposure: Exposure 1.7.7         extended_drawers: Extended Drawers 2.1.1+mc.1.20.1             config_toolkit: ConfigToolkit 1.0.0                 io_determann_shadow-api-17: shadow-api-17 0.1.1                 net_fabricmc_javapoet: javapoet 0.1.0             graphlib: Graph Lib 1.4.0+1.20                 kmodlib-overlay: KModLib Overlay 0.2.12+1.20                 libnetworkstack: Lib Network Stack 0.10.0             noindium: No Indium? 1.1.0+1.20         extendeddrawersaddon: ExtendedDrawersAddon 1.0.2         fabric-api: Fabric API 0.92.2+1.20.1             fabric-api-base: Fabric API Base 0.4.31+1802ada577             fabric-api-lookup-api-v1: Fabric API Lookup API (v1) 1.6.36+1802ada577             fabric-biome-api-v1: Fabric Biome API (v1) 13.0.13+1802ada577             fabric-block-api-v1: Fabric Block API (v1) 1.0.11+1802ada577             fabric-block-view-api-v2: Fabric BlockView API (v2) 1.0.1+1802ada577             fabric-blockrenderlayer-v1: Fabric BlockRenderLayer Registration (v1) 1.1.41+1802ada577             fabric-client-tags-api-v1: Fabric Client Tags 1.1.2+1802ada577             fabric-command-api-v1: Fabric Command API (v1) 1.2.34+f71b366f77             fabric-command-api-v2: Fabric Command API (v2) 2.2.13+1802ada577             fabric-commands-v0: Fabric Commands (v0) 0.2.51+df3654b377             fabric-containers-v0: Fabric Containers (v0) 0.1.64+df3654b377             fabric-content-registries-v0: Fabric Content Registries (v0) 4.0.11+1802ada577             fabric-convention-tags-v1: Fabric Convention Tags 1.5.5+1802ada577             fabric-crash-report-info-v1: Fabric Crash Report Info (v1) 0.2.19+1802ada577             fabric-data-attachment-api-v1: Fabric Data Attachment API (v1) 1.0.0+de0fd6d177             fabric-data-generation-api-v1: Fabric Data Generation API (v1) 12.3.4+1802ada577             fabric-dimensions-v1: Fabric Dimensions API (v1) 2.1.54+1802ada577             fabric-entity-events-v1: Fabric Entity Events (v1) 1.6.0+1c78457f77             fabric-events-interaction-v0: Fabric Events Interaction (v0) 0.6.2+1802ada577             fabric-events-lifecycle-v0: Fabric Events Lifecycle (v0) 0.2.63+df3654b377             fabric-game-rule-api-v1: Fabric Game Rule API (v1) 1.0.40+1802ada577             fabric-item-api-v1: Fabric Item API (v1) 2.1.28+1802ada577             fabric-item-group-api-v1: Fabric Item Group API (v1) 4.0.12+1802ada577             fabric-key-binding-api-v1: Fabric Key Binding API (v1) 1.0.37+1802ada577             fabric-keybindings-v0: Fabric Key Bindings (v0) 0.2.35+df3654b377             fabric-lifecycle-events-v1: Fabric Lifecycle Events (v1) 2.2.22+1802ada577             fabric-loot-api-v2: Fabric Loot API (v2) 1.2.1+1802ada577             fabric-loot-tables-v1: Fabric Loot Tables (v1) 1.1.45+9e7660c677             fabric-message-api-v1: Fabric Message API (v1) 5.1.9+1802ada577             fabric-mining-level-api-v1: Fabric Mining Level API (v1) 2.1.50+1802ada577             fabric-model-loading-api-v1: Fabric Model Loading API (v1) 1.0.3+1802ada577             fabric-models-v0: Fabric Models (v0) 0.4.2+9386d8a777             fabric-networking-api-v1: Fabric Networking API (v1) 1.3.11+1802ada577             fabric-networking-v0: Fabric Networking (v0) 0.3.51+df3654b377             fabric-object-builder-api-v1: Fabric Object Builder API (v1) 11.1.3+1802ada577             fabric-particles-v1: Fabric Particles (v1) 1.1.2+1802ada577             fabric-recipe-api-v1: Fabric Recipe API (v1) 1.0.21+1802ada577             fabric-registry-sync-v0: Fabric Registry Sync (v0) 2.3.3+1802ada577             fabric-renderer-api-v1: Fabric Renderer API (v1) 3.2.1+1802ada577             fabric-renderer-indigo: Fabric Renderer - Indigo 1.5.2+85287f9f77             fabric-renderer-registries-v1: Fabric Renderer Registries (v1) 3.2.46+df3654b377             fabric-rendering-data-attachment-v1: Fabric Rendering Data Attachment (v1) 0.3.37+92a0d36777             fabric-rendering-fluids-v1: Fabric Rendering Fluids (v1) 3.0.28+1802ada577             fabric-rendering-v0: Fabric Rendering (v0) 1.1.49+df3654b377             fabric-rendering-v1: Fabric Rendering (v1) 3.0.8+1802ada577             fabric-resource-conditions-api-v1: Fabric Resource Conditions API (v1) 2.3.8+1802ada577             fabric-resource-loader-v0: Fabric Resource Loader (v0) 0.11.10+1802ada577             fabric-screen-api-v1: Fabric Screen API (v1) 2.0.8+1802ada577             fabric-screen-handler-api-v1: Fabric Screen Handler API (v1) 1.3.30+1802ada577             fabric-sound-api-v1: Fabric Sound API (v1) 1.0.13+1802ada577             fabric-transfer-api-v1: Fabric Transfer API (v1) 3.3.5+8dd72ea377             fabric-transitive-access-wideners-v1: Fabric Transitive Access Wideners (v1) 4.3.1+1802ada577         fabric-language-kotlin: Fabric Language Kotlin 1.12.3+kotlin.2.0.21             org_jetbrains_kotlin_kotlin-reflect: kotlin-reflect 2.0.21             org_jetbrains_kotlin_kotlin-stdlib: kotlin-stdlib 2.0.21             org_jetbrains_kotlin_kotlin-stdlib-jdk7: kotlin-stdlib-jdk7 2.0.21             org_jetbrains_kotlin_kotlin-stdlib-jdk8: kotlin-stdlib-jdk8 2.0.21             org_jetbrains_kotlinx_atomicfu-jvm: atomicfu-jvm 0.25.0             org_jetbrains_kotlinx_kotlinx-coroutines-core-jvm: kotlinx-coroutines-core-jvm 1.9.0             org_jetbrains_kotlinx_kotlinx-coroutines-jdk8: kotlinx-coroutines-jdk8 1.9.0             org_jetbrains_kotlinx_kotlinx-datetime-jvm: kotlinx-datetime-jvm 0.6.1             org_jetbrains_kotlinx_kotlinx-io-bytestring-jvm: kotlinx-io-bytestring-jvm 0.5.4             org_jetbrains_kotlinx_kotlinx-io-core-jvm: kotlinx-io-core-jvm 0.5.4             org_jetbrains_kotlinx_kotlinx-serialization-cbor-jvm: kotlinx-serialization-cbor-jvm 1.7.3             org_jetbrains_kotlinx_kotlinx-serialization-core-jvm: kotlinx-serialization-core-jvm 1.7.3             org_jetbrains_kotlinx_kotlinx-serialization-json-jvm: kotlinx-serialization-json-jvm 1.7.3         fabricloader: Fabric Loader 0.16.9         fancymenu: FancyMenu 3.3.2             com_github_keksuccino_japng: japng 0.5.3             com_github_rtyley_animated-gif-lib-for-java: animated-gif-lib-for-java animated-gif-lib-1.7         farm_and_charm: [Let's Do] Farm & Charm 1.0.4         fastconfigapi: Fast Config API 2.1.0             com_moandjiezana_toml_toml4j: toml4j 0.7.2         fbp: FancyBlockParticles 20.1.1.1         ferritecore: FerriteCore 6.0.1         firstperson: FirstPerson 2.4.5         fishingreal: Fishingreal 1.20.1-1.7.2         fleshz: FleshZ 1.5.1         forgeconfigapiport: Forge Config API Port 8.0.0         formations: Formations 1.0.2         formationsnether: Formations Nether 1.0.5         formationsoverworld: Formations Overworld 1.0.4         fzzy_config: Fzzy Config 0.5.6+1.20.1             fabric-permissions-api-v0: fabric-permissions-api 0.3.1             net_peanuuutz_tomlkt_tomlkt-jvm: tomlkt-jvm 0.3.7         gardens_of_the_dead: Gardens of the Dead 4.0.1         geckoanimfix: GeckoLibIrisCompat 1.0.0         geckolib: GeckoLib 4 4.4.9             com_eliotlash_mclib_mclib: mclib 20         gh: Gods and Heroes 1.6.2         grassoverhaul: Grass Overhaul 23.10.11         handcrafted: Handcrafted 3.0.6         hearths: Hearths 1.0.1         herbalbrews: [Let's Do] HerbalBrews 1.0.8.1         herdspanic: Herds Panic 1.1.0         hopobettermineshaft: Hopo Better Mineshaft 1.1.8         hopobetterunderwaterruins: Hopo Better Underwater Ruins 1.1.4         immediatelyfast: ImmediatelyFast 1.3.1+1.20.4             net_lenni0451_reflect: Reflect 1.3.4         immersive_aircraft: Immersive Aircraft 1.1.2+1.20.1             org_mariuszgromada_math_mathparser_org-mxparser: MathParser.org-mXparser 5.2.1         immersive_armors: Immersive Armors 1.6.1+1.20.1         immersive_melodies: Immersive Melodies 0.3.0+1.20.1         immersivesnow: Immersive Snow 1.3.0         immersiveui: ImmersiveUI 0.2.2         indium: Indium 1.0.34+mc1.20.1         inmis: Inmis 2.7.2-1.20.1         inmisaddon: InmisAddon 1.0.4         interactic: Interactic 0.2.0+1.20         iris: Iris 1.7.5+mc1.20.1             io_github_douira_glsl-transformer: glsl-transformer 2.0.1             org_anarres_jcpp: jcpp 1.4.14             org_antlr_antlr4-runtime: antlr4-runtime 4.13.1         ironchests: Iron Chests: Restocked 5.0.2         java: OpenJDK 64-Bit Server VM 17         jobsaddon: JobsAddon 1.1.6         journeymap: Journeymap 5.10.3             journeymap-api-fabric: JourneyMap API 1.20-1.9-fabric-SNAPSHOT         jumpoverfences: Jump Over Fences 1.3.1         justoutdoorstuffs: Just Outdoor Stuffs 1.0.2         keybind_fix: Keybind Fix 1.0.0         kiwi: Kiwi Library 11.8.26+fabric         konkrete: Konkrete 1.8.1         labellingcontainers: Labelling Containers 1.8.0         labels: labels 1.20-1.20.2         lambdynlights: LambDynamicLights 2.3.2+1.20.1             pride: Pride Lib 1.2.0+1.19.4             spruceui: SpruceUI 5.0.0+1.20         lavender: Lavender 0.1.9+1.20             lavender-md: lavender-md 0.1.1+1.20             lavender-md-owo-ui: lavender-md-owo-ui 0.1.1+1.20         leahs-immersive-thunder: Immersive Thunder 1.20.1+1.2.2         letmedespawn: Let Me Despawn 1.4.4         levelz: LevelZ 1.4.13         libz: LibZ 1.0.3         lithium: Lithium 0.11.2         lmft: Load My F***ing Tags 1.0.2+1.20         loadmyresources: Load My Resources 1.0.4         logbegone: Log Begone 1.0.8         lootbeams: Lootbeams 2.1.1+1.20.1             microconfig: Microconfig 3.0.0         lootr: Lootr 0.7.33.81         luphieclutteredmod: Cluttered 2.1.0+1.20.1         mcwpaintings: Macaw's Paintings 1.0.5         meadow: [Let's Do] Meadow 1.3.19             mixinsquared: MixinSquared 0.1.2-beta.5         medieval_buildings: Medieval Buildings 1.0.1         medievalweapons: Medieval Weapons 1.4.8         melody: Melody 1.0.3         memoryleakfix: Memory Leak Fix 1.1.5         mes: Moog's End Structures 1.3.1-1.20-fabric         minecraft: Minecraft 1.20.1         mns: Moog's Nether Structures 1.0.1-1.20-fabric         modelfix: Model Gap Fix 1.15         modernfix: ModernFix 5.19.4+mc1.20.1         modmenu: Mod Menu 7.2.2         moonlight: Moonlight 1.20-2.13.25         more_armor_trims: More Armor Trims 1.4.1-1.20.1         moreculling: More Culling 1.20.4-0.24.0         mr_animated_doors: Animated Doors 1.0         mr_better_babies: Better Babies 0.6.2         mr_developer_resources: Data API 0.2         mr_dungeons: Dungeons+ 1.8.4b         mr_dungeons_andtaverns: Dungeons and Taverns 3.0.3.f         mr_dungeons_andtavernsancientcityoverhaul: Dungeons and Taverns Ancient City Overhaul 1         mr_dungeons_andtavernspillageroutpostrework: Dungeons and Taverns Pillager Outpost Rework 1.1         mr_dungeons_andtavernsstrongholdrework: Dungeons and Taverns Stronghold Rework 1         mr_lukis_grandcapitals: Luki's Grand Capitals 1.0         mr_origins_vampire: Origins: Vampire 1-v2.2.0         mr_ships: Ships 3.0.3         mr_true_ending: True Ending: Ender Dragon Overhaul 1-v1.1.0c         mr_villager_transportation: Villager Transportation 1.3.1         mru: Mineblock's Repeated Utilities 1.0.4+1.20.1+fabric         myloot: myLoot 4.0.3-1.20.1         mythicmetals: Mythic Metals 0.19.9+1.20.1             additionalentityattributes: Additional Entity Attributes 1.7.3+1.20.0             common-protection-api: Common Protection API 1.0.0         nameplate: Nameplate 1.1.4         naturalist: Naturalist 4.0.3         natures_spirit: Nature's Spirit 1.6.3-1.20.1         neruina: Neruina 2.1.2             com_fasterxml_jackson_core_jackson-annotations: jackson-annotations 2.17.0             com_fasterxml_jackson_core_jackson-core: jackson-core 2.17.0             com_fasterxml_jackson_core_jackson-databind: jackson-databind 2.17.0             org_apache_maven_maven-artifact: maven-artifact 3.8.1             org_kohsuke_github-api: github-api 1.318         nethervinery: [Let's Do] NetherVinery 1.2.14         niftycarts: NiftyCarts 20.1.3         nimble: Nimble 5.0.1         noisium: Noisium 2.3.0+mc1.20-1.20.1         nutritionz: NutritionZ 1.0.11         nyctophobia: Nyctophobia 1.9         octolib: OctoLib 0.4.2             org_yaml_snakeyaml: snakeyaml 2.2         origins: Origins 1.10.0             apoli: Apoli 2.9.0                 calio: Calio 1.11.0                 playerabilitylib: Pal 1.8.0         overflowingbars: Overflowing Bars 8.0.1         owo: oωo 0.11.2+1.20         particular: Particular 1.1.1         partyaddon: PartyAddon 1.0.4         passablefoliage: Passable Foliage 1.20.1-fabric-8.2.1         patchouli: Patchouli 1.20.1-84-FABRIC             fiber: fiber 0.23.0-2         paxi: Paxi 1.20-Fabric-4.0         pehkui: Pehkui 3.8.3+1.14.4-1.21             kanos_config: Kanos Config 0.4.1+1.14.4-1.19.4         phantom: Phantom Library 20.1.5         player-animator: Player Animator 1.0.2-rc1+1.20         plushables: Plushables 1.1.3         pockets: Pockets 1.2.0         portfolio: Portfolio 1.20.1-1.4.0-fabric         presencefootsteps: Presence Footsteps 1.9.4+1.20.1             kirin: Kirin UI 1.15.6+1.20.1         profundis: Profundis 1.6.2         promenade: Promenade 4.1.1             biolith: Biolith 1.0.0-alpha.8                 terraform-surfaces-api-v1: Terraform Surfaces API (v1) 7.0.1         puzzleslib: Puzzles Lib 8.1.24             puzzlesaccessapi: Puzzles Access Api 8.0.7         reciperemover: Recipe Remover 1.0.11         regions_unexplored: Regions Unexplored 0.5.6+1.20.1         resourcefulconfig: Resourcefulconfig 2.1.2         resourcefullib: Resourceful Lib 2.1.29             com_teamresourceful_bytecodecs: bytecodecs 1.0.2             com_teamresourceful_yabn: yabn 1.0.3         revive: Revive 1.0.7         rpgdifficulty: RpgDifficulty 1.3.15         rsls: Raise Sound Limit Simplified 1.1.5         scholar: Scholar 1.0.0         seamless_loading_screen: Seamless Loading Screen 2.0.3+1.20.1         seasonhud: SeasonHUD 1.11.2         seasons: Fabric Seasons 2.4.2-BETA+1.20         shut_up_gl_error: Shut Up GL Error 1.0.0         simplemod: SimpleMod 1.20.1         skinlayers3d: 3d-Skin-Layers 1.7.0         smallships: Small Ships 2.0.0-b1.4         smarterfarmers: Smarter Farmers 1.20-2.1.0         smitherz: SmitherZ 1.0.4         smoothscrollingrefurbished: Smooth Scrolling Refurbished 1.1.2         smoothswapping: Smooth Swapping 0.9.3.1         sodium: Sodium 0.5.11+mc1.20.1         sound_physics_remastered: Sound Physics Remastered 1.20.1-1.4.5         sounds: Sounds 2.2.0+1.20.1+fabric             mixinextras: MixinExtras 0.5.0-beta.2             yet_another_config_lib_v3: YetAnotherConfigLib 3.5.0+1.20.1-fabric                 com_twelvemonkeys_common_common-image: common-image 3.10.0                 com_twelvemonkeys_common_common-io: common-io 3.10.0                 com_twelvemonkeys_common_common-lang: common-lang 3.10.0                 com_twelvemonkeys_imageio_imageio-core: imageio-core 3.10.0                 com_twelvemonkeys_imageio_imageio-metadata: imageio-metadata 3.10.0                 com_twelvemonkeys_imageio_imageio-webp: imageio-webp 3.10.0                 org_quiltmc_parsers_gson: gson 0.2.1         sparsestructures: SparseStructures 2.2.0         spawn: Spawn 1.0.3-fabric         spawnanimations: Spawn Animations 1.9.4+mod         spider_caves: Spider Caves 20.1.0         spoiledz: SpoiledZ 1.0.10             capsaicin: Capsaicin 1.3.3+mc1.20.1         spoornpacks: SpoornPacks 5.0-1.20.1         stoneworks: Stoneworks 8.0.0         storagedelight: Storage Delight 24.9.11-1.20-fabric         superbsteeds: Superb Steeds 1.20-4         supermartijn642configlib: SuperMartijn642's Config Lib 1.1.8+a         supplementaries: Supplementaries 1.20-3.1.9         suppsquared: Supplementaries Squared 1.20-1.1.18         surveyor: Surveyor Map Framework 0.6.25+1.20         sushi_bar: Sushi Bar 0.2.2+1.20             com_moulberry_mixinconstraints: mixinconstraints 1.0.1         tawct: Time & Wind Custom Ticker 1.4.8+1.20-1.20.1         tcdcommons: TCD Commons API 3.12.3+fabric-1.20.1         tenseambience: Tense Ambience 1.7.0             com_github_umjammer_jlayer: jlayer 1.0.2         terrablender: TerraBlender 3.0.1.7             com_electronwill_night-config_core: core 3.6.7             com_electronwill_night-config_toml: toml 3.6.7         tiered: Tiered 1.3.3         tlc: The Lost Castle 1.0.1         tool_trims: Tool Trims 2.2.1         tooltipfix: ToolTip Fix 1.1.1-1.20         translucencyfix: Translucency Fix 2.2.0         travelersbackpack: Traveler's Backpack 9.1.18         travelerz: TravelerZ 1.0.1         treechop: HT's TreeChop 0.19.0         trimeffects: TrimsEffects 1.3.5         trinkets: Trinkets 3.7.2         u_desert: Unnamed Desert 1.3.1         underground_jungle: Underground Jungle 20.1.2         veinmining: Vein Mining 1.5.0+1.20.1             spectrelib: SpectreLib 0.13.15+1.20.1         villagerfix: Villager Trade Fix 1.0.4         villagesandpillages: Villages & Pillages 1.0.1         vinery: [Let's Do] Vinery 1.4.28         void_lib: Void Lib 1.1.5         voidtotem: Void Totem 3.0.1         voidz: VoidZ 1.0.11         walkers: Walkers 5.4         waterdripsound: Drip Sounds 1.19-0.3.2         welcomescreen: WelcomeScreen 1.0.1         wildlife: Wildlife 1.19.2-2.2         yungsapi: YUNG's API 1.20-Fabric-4.0.6             org_javassist_javassist: javassist 3.29.2-GA     Loaded Shaderpack: (off)     Server Running: true     Player Count: 0 / 8; []     Data Packs: vanilla, fabric, nutritionz:promenade_nutrition_compat, natures_spirit:modified_mountain_biomes, nutritionz:dehydration_x_meadow_nutrition_compat, natures_spirit:modified_dark_forest, jobsaddon:supplementaries_compat, natures_spirit:modified_birch_forest, nutritionz:candlelight_nutrition_compat, jobsaddon:earlystage_compat, nutritionz:brewery_nutrition_compat, nutritionz:herbalbrews_nutrition_compat, nutritionz:dehydration_x_vinery_nutrition_compat, nutritionz:adventurez_nutrition_compat, natures_spirit:modified_windswept_hills, jobsaddon:candlelight_compat, nutritionz:natures_spirit_nutrition_compat, nutritionz:bakery_nutrition_compat, nutritionz:spawn_nutrition_compat, nutritionz:farm_and_charm_nutrition_compat, nutritionz:naturalist_nutrition_compat, nutritionz:regions_unexplored_nutrition_compat, natures_spirit:modified_jungle, fleshz:adventurez_compat, nutritionz:vinery_nutrition_compat, natures_spirit:modified_swamp, natures_spirit:modified_flower_forest, natures_spirit:modified_desert, nutritionz:dehydration_nutrition_compat, fleshz:naturalist_compat, fleshz:meadow_compat, jobsaddon:vinery_compat, nutritionz:dehydration_x_nethervinery_nutrition_compat, nutritionz:supplementaries_nutrition_compat, jobsaddon:bakery_compat, natures_spirit:modified_savannas, nutritionz:meadow_nutrition_compat, nutritionz:nethervinery_nutrition_compat, natures_spirit:modified_badlands, Everycomp Generated Pack, Moonlight Mods Dynamic Assets, Supplementaries Generated Pack, Suppsquared Generated Pack, loadmyresources.hiddenpack (incompatible), spoornpacks, aged, aged_welcome_screen, create-the-server_datapack-v0.2, WWOO_2.3.1 (incompatible)     Enabled Feature Flags: minecraft:vanilla     World Generation: Stable     Type: Integrated Server (map_client.txt)     Is Modded: Definitely; Client brand changed to 'fabric'; Server brand changed to 'fabric'     Launched Version: 1.20.1
    • Use the public BlockEntityType constructor.
    • Use a Custom Launcher like Technic Launcher and search for a "Clean Forge 1.12.2" modpack and use this as working base
  • Topics

×
×
  • Create New...

Important Information

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