net.minecraft.entity.item.EntityItemFrame Java Examples
The following examples show how to use
net.minecraft.entity.item.EntityItemFrame.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: EntityRendererHook.java From SkyblockAddons with MIT License | 6 votes |
public static void removeEntities(List<Entity> list) { SkyblockAddons main = SkyblockAddons.getInstance(); if (main.getUtils().isOnSkyblock()) { int keyCode = Minecraft.getMinecraft().gameSettings.keyBindUseItem.getKeyCode(); boolean isUseKeyDown = false; try { if (keyCode < 0) { isUseKeyDown = Mouse.isButtonDown(Minecraft.getMinecraft().gameSettings.keyBindUseItem.getKeyCode() + 100); } else { isUseKeyDown = Keyboard.isKeyDown(Minecraft.getMinecraft().gameSettings.keyBindUseItem.getKeyCode()); } } catch (Throwable ex) { ex.printStackTrace(); // Uhh I messed up something with the key detection... fix? } if (!GuiScreen.isCtrlKeyDown() && isUseKeyDown && main.getConfigValues().isEnabled(Feature.IGNORE_ITEM_FRAME_CLICKS)) { list.removeIf(listEntity -> listEntity instanceof EntityItemFrame && (((EntityItemFrame)listEntity).getDisplayedItem() != null || Minecraft.getMinecraft().thePlayer.getHeldItem() == null)); } if (main.getConfigValues().isEnabled(Feature.HIDE_PLAYERS_NEAR_NPCS)) { list.removeIf(entity -> entity instanceof EntityOtherPlayerMP && NPCUtils.isNearAnyNPCWithTag(entity, Tag.IMPORTANT) && !NPCUtils.isNPC(entity)); } } }
Example #2
Source File: TrackingRange.java From Kettle with GNU General Public License v3.0 | 6 votes |
/** * Gets the range an entity should be 'tracked' by players and visible in * the client. * * @param entity * @param defaultRange Default range defined by Mojang * @return */ public static int getEntityTrackingRange(Entity entity, int defaultRange) { SpigotWorldConfig config = entity.world.spigotConfig; if (entity instanceof EntityPlayer) { return config.playerTrackingRange; } else if (entity.activationType == 1) { return config.monsterTrackingRange; } else if (entity instanceof EntityGhast) { if (config.monsterTrackingRange > config.monsterActivationRange) { return config.monsterTrackingRange; } else { return config.monsterActivationRange; } } else if (entity.activationType == 2) { return config.animalTrackingRange; } else if (entity instanceof EntityItemFrame || entity instanceof EntityPainting || entity instanceof EntityItem || entity instanceof EntityXPOrb) { return config.miscTrackingRange; } else { return config.otherTrackingRange; } }
Example #3
Source File: CraftEventFactory.java From Thermos with GNU General Public License v3.0 | 6 votes |
public static boolean handleNonLivingEntityDamageEvent(Entity entity, DamageSource source, double damage) { if (entity instanceof EntityEnderCrystal && !(source instanceof EntityDamageSource)) { return false; } final EnumMap<DamageModifier, Double> modifiers = new EnumMap<DamageModifier, Double>(DamageModifier.class); final EnumMap<DamageModifier, Function<? super Double, Double>> functions = new EnumMap(DamageModifier.class); modifiers.put(DamageModifier.BASE, damage); functions.put(DamageModifier.BASE, ZERO); final EntityDamageEvent event = handleEntityDamageEvent(entity, source, modifiers, functions); if (event == null) { return false; } return event.isCancelled() || (event.getDamage() == 0 && !(entity instanceof EntityItemFrame)); // Cauldron - fix frame removal }
Example #4
Source File: RenderManagerHook.java From SkyblockAddons with MIT License | 5 votes |
public static void shouldRender(Entity entityIn, ReturnValue<Boolean> returnValue) { SkyblockAddons main = SkyblockAddons.getInstance(); if (main.getUtils().isOnSkyblock()) { Location currentLocation = main.getUtils().getLocation(); if (entityIn instanceof EntityItem && entityIn.ridingEntity instanceof EntityArmorStand && entityIn.ridingEntity.isInvisible()) { // Conditions for skeleton helmet flying bones if (main.getConfigValues().isEnabled(Feature.HIDE_BONES)) { returnValue.cancel(); } } if (main.getConfigValues().isEnabled(Feature.HIDE_PLAYERS_NEAR_NPCS)) { if (entityIn instanceof EntityOtherPlayerMP && NPCUtils.isNearAnyNPCWithTag(entityIn, Tag.IMPORTANT) && !NPCUtils.isNPC(entityIn)) { returnValue.cancel(); } } if (main.getConfigValues().isEnabled(Feature.HIDE_PLAYERS_IN_LOBBY)) { if (currentLocation == Location.VILLAGE || currentLocation == Location.AUCTION_HOUSE || currentLocation == Location.BANK) { if ((entityIn instanceof EntityOtherPlayerMP || entityIn instanceof EntityFX || entityIn instanceof EntityItemFrame) && entityIn.getDistanceToEntity(Minecraft.getMinecraft().thePlayer) > 7) { returnValue.cancel(); } } } if(main.getConfigValues().isEnabled(Feature.HIDE_SVEN_PUP_NAMETAGS)) { if (entityIn instanceof EntityArmorStand && entityIn.hasCustomName()) { String customNameTag = entityIn.getCustomNameTag(); if (customNameTag.contains("Sven Pup")) { returnValue.cancel(); } } } } }
Example #5
Source File: MinecraftHook.java From SkyblockAddons with MIT License | 5 votes |
public static void rightClickMouse(ReturnValue<?> returnValue) { SkyblockAddons main = SkyblockAddons.getInstance(); if (main.getUtils().isOnSkyblock()) { Minecraft mc = Minecraft.getMinecraft(); if (mc.objectMouseOver != null && mc.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY) { Entity entityIn = mc.objectMouseOver.entityHit; if (main.getConfigValues().isEnabled(Feature.DONT_OPEN_PROFILES_WITH_BOW)) { if (entityIn instanceof EntityOtherPlayerMP && !NPCUtils.isNPC(entityIn)) { ItemStack item = mc.thePlayer.inventory.getCurrentItem(); ItemStack itemInUse = mc.thePlayer.getItemInUse(); if ((isItemBow(item) || isItemBow(itemInUse))) { if (System.currentTimeMillis() - lastProfileMessage > 20000) { lastProfileMessage = System.currentTimeMillis(); main.getUtils().sendMessage(main.getConfigValues().getRestrictedColor(Feature.DONT_OPEN_PROFILES_WITH_BOW) + Message.MESSAGE_STOPPED_OPENING_PROFILE.getMessage()); } returnValue.cancel(); return; } } } if (main.getConfigValues().isEnabled(Feature.LOCK_SLOTS) && entityIn instanceof EntityItemFrame && ((EntityItemFrame)entityIn).getDisplayedItem() == null) { int slot = mc.thePlayer.inventory.currentItem + 36; if (main.getConfigValues().getLockedSlots().contains(slot) && slot >= 9) { main.getUtils().playLoudSound("note.bass", 0.5); main.getUtils().sendMessage(main.getConfigValues().getRestrictedColor(Feature.DROP_CONFIRMATION) + Message.MESSAGE_SLOT_LOCKED.getMessage()); returnValue.cancel(); } } } } }
Example #6
Source File: CraftItemFrame.java From Kettle with GNU General Public License v3.0 | 5 votes |
private void update() { EntityItemFrame old = this.getHandle(); WorldServer world = ((CraftWorld) getWorld()).getHandle(); BlockPos position = old.getPosition(); EnumFacing direction = old.getHorizontalFacing(); ItemStack item = old.getDisplayedItem() != null ? old.getDisplayedItem().copy() : null; old.setDead(); EntityItemFrame frame = new EntityItemFrame(world, position, direction); frame.setDisplayedItem(item); world.spawnEntity(frame); this.entity = frame; }
Example #7
Source File: StorageESPMod.java From ForgeHax with MIT License | 5 votes |
private int getEntityColor(Entity entity) { if (entity instanceof EntityMinecartChest) { return Colors.ORANGE.toBuffer(); } else if (entity instanceof EntityItemFrame && ((EntityItemFrame) entity).getDisplayedItem().getItem() instanceof ItemShulkerBox) { return Colors.YELLOW.toBuffer(); } else { return -1; } }
Example #8
Source File: EntityEventHandler.java From GriefPrevention with MIT License | 5 votes |
@Listener(order = Order.FIRST, beforeModifications = true) public void onEntityCollideEntity(CollideEntityEvent event) { if (!GPFlags.ENTITY_COLLIDE_ENTITY || event instanceof CollideEntityEvent.Impact) { return; } //if (GriefPreventionPlugin.isSourceIdBlacklisted(ClaimFlag.ENTITY_COLLIDE_ENTITY.toString(), event.getSource(), event.getEntities().get(0).getWorld().getProperties())) { // return; //} Object rootCause = event.getCause().root(); final boolean isRootEntityItemFrame = rootCause instanceof EntityItemFrame; if (!isRootEntityItemFrame) { return; } GPTimings.ENTITY_COLLIDE_EVENT.startTimingIfSync(); event.filterEntities(new Predicate<Entity>() { @Override public boolean test(Entity entity) { // Avoid living entities breaking itemframes if (isRootEntityItemFrame && entity instanceof EntityLiving) { return false; } return true; } }); GPTimings.ENTITY_COLLIDE_EVENT.stopTimingIfSync(); }
Example #9
Source File: TrackingRange.java From Thermos with GNU General Public License v3.0 | 5 votes |
/** * Gets the range an entity should be 'tracked' by players and visible in * the client. * * @param entity * @param defaultRange Default range defined by Mojang * @return */ public static int getEntityTrackingRange(Entity entity, int defaultRange) { SpigotWorldConfig config = entity.worldObj.getSpigotConfig(); // Cauldron int range = defaultRange; if ( entity instanceof EntityPlayerMP ) { range = config.playerTrackingRange; } else if ( entity.defaultActivationState || entity instanceof EntityGhast ) { range = defaultRange; } else if ( entity.activationType == 1 ) { range = config.monsterTrackingRange; } else if ( entity.activationType == 2 ) { range = config.animalTrackingRange; } else if ( entity instanceof EntityItemFrame || entity instanceof EntityPainting || entity instanceof EntityItem || entity instanceof EntityXPOrb ) { range = config.miscTrackingRange; } // Cauldron start - allow for 0 to disable tracking ranges if (range == 0) { return defaultRange; } // Cauldron end return Math.min( config.maxTrackingRange, range ); }
Example #10
Source File: ItemFrameMetaProvider.java From OpenPeripheral-Integration with MIT License | 5 votes |
@Override public Object getMeta(EntityItemFrame target, Vec3 relativePos) { Map<String, Object> result = Maps.newHashMap(); result.put("item", target.getDisplayedItem()); result.put("rotation", target.getRotation()); return result; }
Example #11
Source File: MixinEntityRenderer.java From LiquidBounce with GNU General Public License v3.0 | 4 votes |
/** * @author */ @Overwrite public void getMouseOver(float p_getMouseOver_1_) { Entity entity = this.mc.getRenderViewEntity(); if(entity != null && this.mc.theWorld != null) { this.mc.mcProfiler.startSection("pick"); this.mc.pointedEntity = null; final Reach reach = (Reach) LiquidBounce.moduleManager.getModule(Reach.class); double d0 = reach.getState() ? reach.getMaxRange() : (double) this.mc.playerController.getBlockReachDistance(); this.mc.objectMouseOver = entity.rayTrace(reach.getState() ? reach.getBuildReachValue().get() : d0, p_getMouseOver_1_); double d1 = d0; Vec3 vec3 = entity.getPositionEyes(p_getMouseOver_1_); boolean flag = false; if(this.mc.playerController.extendedReach()) { d0 = 6.0D; d1 = 6.0D; }else if(d0 > 3.0D) { flag = true; } if(this.mc.objectMouseOver != null) { d1 = this.mc.objectMouseOver.hitVec.distanceTo(vec3); } if(reach.getState()) { d1 = reach.getCombatReachValue().get(); final MovingObjectPosition movingObjectPosition = entity.rayTrace(d1, p_getMouseOver_1_); if(movingObjectPosition != null) d1 = movingObjectPosition.hitVec.distanceTo(vec3); } Vec3 vec31 = entity.getLook(p_getMouseOver_1_); Vec3 vec32 = vec3.addVector(vec31.xCoord * d0, vec31.yCoord * d0, vec31.zCoord * d0); this.pointedEntity = null; Vec3 vec33 = null; float f = 1.0F; List<Entity> list = this.mc.theWorld.getEntitiesInAABBexcluding(entity, entity.getEntityBoundingBox().addCoord(vec31.xCoord * d0, vec31.yCoord * d0, vec31.zCoord * d0).expand((double) f, (double) f, (double) f), Predicates.and(EntitySelectors.NOT_SPECTATING, p_apply_1_ -> p_apply_1_.canBeCollidedWith())); double d2 = d1; for(int j = 0; j < list.size(); ++j) { Entity entity1 = (Entity) list.get(j); float f1 = entity1.getCollisionBorderSize(); AxisAlignedBB axisalignedbb = entity1.getEntityBoundingBox().expand((double) f1, (double) f1, (double) f1); MovingObjectPosition movingobjectposition = axisalignedbb.calculateIntercept(vec3, vec32); if(axisalignedbb.isVecInside(vec3)) { if(d2 >= 0.0D) { this.pointedEntity = entity1; vec33 = movingobjectposition == null ? vec3 : movingobjectposition.hitVec; d2 = 0.0D; } }else if(movingobjectposition != null) { double d3 = vec3.distanceTo(movingobjectposition.hitVec); if(d3 < d2 || d2 == 0.0D) { if(entity1 == entity.ridingEntity && !entity.canRiderInteract()) { if(d2 == 0.0D) { this.pointedEntity = entity1; vec33 = movingobjectposition.hitVec; } }else{ this.pointedEntity = entity1; vec33 = movingobjectposition.hitVec; d2 = d3; } } } } if (this.pointedEntity != null && flag && vec3.distanceTo(vec33) > (reach.getState() ? reach.getCombatReachValue().get() : 3.0D)) { this.pointedEntity = null; this.mc.objectMouseOver = new MovingObjectPosition(MovingObjectPosition.MovingObjectType.MISS, vec33, (EnumFacing) null, new BlockPos(vec33)); } if(this.pointedEntity != null && (d2 < d1 || this.mc.objectMouseOver == null)) { this.mc.objectMouseOver = new MovingObjectPosition(this.pointedEntity, vec33); if(this.pointedEntity instanceof EntityLivingBase || this.pointedEntity instanceof EntityItemFrame) { this.mc.pointedEntity = this.pointedEntity; } } this.mc.mcProfiler.endSection(); } }
Example #12
Source File: MixinEntityRenderer.java From Hyperium with GNU Lesser General Public License v3.0 | 4 votes |
/** * @author - Sk1er (added forward for distance) * @reason - ReachDisplay */ @Overwrite public void getMouseOver(float partialTicks) { Entity entity = mc.getRenderViewEntity(); if (entity != null && mc.theWorld != null) { mc.mcProfiler.startSection("pick"); mc.pointedEntity = null; double d0 = mc.playerController.getBlockReachDistance(); mc.objectMouseOver = entity.rayTrace(d0, partialTicks); double d1 = d0; Vec3 vec3 = entity.getPositionEyes(partialTicks); boolean flag = false; if (mc.playerController.extendedReach()) { d0 = 6.0D; d1 = 6.0D; } else if (d0 > 3.0D) { flag = true; } if (mc.objectMouseOver != null) d1 = mc.objectMouseOver.hitVec.distanceTo(vec3); Vec3 vec31 = entity.getLook(partialTicks); Vec3 vec32 = vec3.addVector(vec31.xCoord * d0, vec31.yCoord * d0, vec31.zCoord * d0); pointedEntity = null; Vec3 vec33 = null; float f = 1.0F; List<Entity> list = mc.theWorld.getEntitiesInAABBexcluding(entity, entity.getEntityBoundingBox().addCoord(vec31.xCoord * d0, vec31.yCoord * d0, vec31.zCoord * d0).expand(f, f, f), Predicates.and(EntitySelectors.NOT_SPECTATING, Entity::canBeCollidedWith)); double d2 = d1; for (Entity entity1 : list) { float f1 = entity1.getCollisionBorderSize(); AxisAlignedBB axisalignedbb = entity1.getEntityBoundingBox().expand(f1, f1, f1); MovingObjectPosition movingobjectposition = axisalignedbb.calculateIntercept(vec3, vec32); if (axisalignedbb.isVecInside(vec3)) { if (d2 >= 0.0D) { pointedEntity = entity1; vec33 = movingobjectposition == null ? vec3 : movingobjectposition.hitVec; d2 = 0.0D; } } else if (movingobjectposition != null) { double d3 = vec3.distanceTo(movingobjectposition.hitVec); if (d3 < d2 || d2 == 0.0D) { if (entity1 == entity.ridingEntity) { if (d2 == 0.0D) { pointedEntity = entity1; vec33 = movingobjectposition.hitVec; } } else { pointedEntity = entity1; vec33 = movingobjectposition.hitVec; d2 = d3; } } } } double v = 0; if (pointedEntity != null && flag && (v = vec3.distanceTo(vec33)) > 3.0D) { pointedEntity = null; mc.objectMouseOver = new MovingObjectPosition(MovingObjectPosition.MovingObjectType.MISS, vec33, null, new BlockPos(vec33)); } if (v != 0 || pointedEntity != null) ReachDisplay.dis = v; if (pointedEntity != null && (d2 < d1 || mc.objectMouseOver == null)) { mc.objectMouseOver = new MovingObjectPosition(pointedEntity, vec33); if (pointedEntity instanceof EntityLivingBase || pointedEntity instanceof EntityItemFrame) { mc.pointedEntity = pointedEntity; } } mc.mcProfiler.endSection(); } }
Example #13
Source File: MixinRenderItemFrame.java From Hyperium with GNU Lesser General Public License v3.0 | 4 votes |
@Inject(method = "doRender", at = @At("HEAD"), cancellable = true) private void doRender(EntityItemFrame entity, double x, double y, double z, float entityYaw, float partialTicks, CallbackInfo ci) { if (Settings.DISABLE_ITEMFRAMES) ci.cancel(); }
Example #14
Source File: CraftItemFrame.java From Kettle with GNU General Public License v3.0 | 4 votes |
public CraftItemFrame(CraftServer server, EntityItemFrame entity) { super(server, entity); }
Example #15
Source File: CraftItemFrame.java From Kettle with GNU General Public License v3.0 | 4 votes |
@Override public EntityItemFrame getHandle() { return (EntityItemFrame) entity; }
Example #16
Source File: Entity.java From TickDynamic with MIT License | 4 votes |
/** * Called when a user uses the creative pick block button on this entity. * * @param target The full target the player is looking at * @return A ItemStack to add to the player's inventory, Null if nothing should be added. */ public ItemStack getPickedResult(MovingObjectPosition target) { if (this instanceof EntityPainting) { return new ItemStack(Items.painting); } else if (this instanceof EntityLeashKnot) { return new ItemStack(Items.lead); } else if (this instanceof EntityItemFrame) { ItemStack held = ((EntityItemFrame)this).getDisplayedItem(); if (held == null) { return new ItemStack(Items.item_frame); } else { return held.copy(); } } else if (this instanceof EntityMinecart) { return ((EntityMinecart)this).getCartItem(); } else if (this instanceof EntityBoat) { return new ItemStack(Items.boat); } else { int id = EntityList.getEntityID(this); if (id > 0 && EntityList.entityEggs.containsKey(id)) { return new ItemStack(Items.spawn_egg, 1, id); } } return null; }