Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @SubscribeEvent
- public void render(RenderWorldLastEvent e) {
- if(Minecraft.getMinecraft().player != null) {
- EntityPlayer player = Minecraft.getMinecraft().player;
- ItemStack stack;
- if(player.getHeldItemMainhand().getItem() == this){
- stack = player.getHeldItem(EnumHand.MAIN_HAND);
- }
- else if(player.getHeldItemOffhand().getItem() == this){
- stack = player.getHeldItem(EnumHand.OFF_HAND);
- }
- else {
- return;
- }
- if(stack.hasTagCompound() && sameWorlds(stack) && getWorlds(stack)[0].getWorldType().getId() == player.world.getWorldType().getId()) {
- BlockPos pos1 = getPos1(stack);
- BlockPos pos2 = getPos2(stack);
- AxisAlignedBB box = new AxisAlignedBB(pos1, pos2);
- box = box.expand(1, 1, 1);
- double x = interpolate(-player.lastTickPosX, -player.posX, e.getPartialTicks());
- double y = interpolate(-player.lastTickPosY, -player.posY, e.getPartialTicks());
- double z = interpolate(-player.lastTickPosZ, -player.posZ, e.getPartialTicks());
- box = box.offset(x, y, z);
- RenderGlobal.drawSelectionBoundingBox(box, 1f, 1f, 1f, 1f);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement