use of net.minecraft.entity.ItemEntity in project Biome-Makeover by Lemonszz.
the class EctoplasmComposterBlock method emptyFullComposter.
public static void emptyFullComposter(World world, BlockPos pos) {
if (!world.isClient) {
float offset = 0.7F;
double offsetX = (double) (world.random.nextFloat() * offset) + 0.15D;
double offsetY = (double) (world.random.nextFloat() * offset) + 0.06D + 0.6D;
double offsetZ = (double) (world.random.nextFloat() * offset) + 0.15D;
ItemEntity itemEntity = new ItemEntity(world, (double) pos.getX() + offsetX, (double) pos.getY() + offsetY, (double) pos.getZ() + offsetZ, new ItemStack(Blocks.SOUL_SOIL));
itemEntity.setToDefaultPickupDelay();
world.spawnEntity(itemEntity);
}
BlockState originalState = Blocks.COMPOSTER.getDefaultState();
world.setBlockState(pos, originalState);
world.playSound(null, pos, SoundEvents.BLOCK_COMPOSTER_EMPTY, SoundCategory.BLOCKS, 1.0F, 1.0F);
}
use of net.minecraft.entity.ItemEntity in project Terracraft by SimplyCmd.
the class PotBlock method dropCoins.
private void dropCoins(World world, BlockPos pos) {
// Spawn silver coins from 0-3
for (int i = 0; i < RANDOM.nextInt(3); i++) {
ItemEntity coin = new ItemEntity(world, pos.getX(), pos.getY(), pos.getZ(), ItemRegistry.silver_coin.getItem().getDefaultStack());
world.spawnEntity(coin);
}
// Spawn copper coins from 0-64
ItemStack copper_coins = ItemRegistry.copper_coin.getItem().getDefaultStack();
copper_coins.setCount(RANDOM.nextInt(64));
ItemEntity coin = new ItemEntity(world, pos.getX(), pos.getY(), pos.getZ(), copper_coins);
world.spawnEntity(coin);
}
use of net.minecraft.entity.ItemEntity in project Hypnotic-Client by Hypnotic-Development.
the class RenderUtils method drawEntityBox.
public static void drawEntityBox(MatrixStack matrixstack, Entity entity, double x, double y, double z, Color color) {
setup3DRender(true);
matrixstack.translate(x, y, z);
matrixstack.multiply(new Quaternion(new Vec3f(0, -1, 0), 0, true));
matrixstack.translate(-x, -y, -z);
Box bb = new Box(x - entity.getWidth() + 0.25, y, z - entity.getWidth() + 0.25, x + entity.getWidth() - 0.25, y + entity.getHeight() + 0.1, z + entity.getWidth() - 0.25);
if (entity instanceof ItemEntity)
bb = new Box(x - 0.15, y + 0.1f, z - 0.15, x + 0.15, y + 0.5, z + 0.15);
drawFilledBox(matrixstack, bb, new Color(color.getRed(), color.getGreen(), color.getBlue(), 130), true);
RenderSystem.lineWidth(1.5f);
drawOutlineBox(matrixstack, bb, color, true);
end3DRender();
matrixstack.translate(x, y, z);
matrixstack.multiply(new Quaternion(new Vec3f(0, 1, 0), 0, true));
matrixstack.translate(-x, -y, -z);
}
use of net.minecraft.entity.ItemEntity in project Hypnotic-Client by Hypnotic-Development.
the class Nametags method getNameString.
public String getNameString(Entity entity) {
String name = entity.getDisplayName().asString();
PlayerListEntry playerListEntry = mc.getNetworkHandler().getPlayerListEntry(entity.getUuid());
String gameModeText = gamemode.isEnabled() ? (playerListEntry != null ? ColorUtils.aqua + playerListEntry.getGameMode().getName().substring(0, 1).toUpperCase() + " " + ColorUtils.reset : "") : "";
String pingText = ping.isEnabled() ? (playerListEntry != null ? playerListEntry.getLatency() : "0") + "ms " : "";
String distanceText = distance.isEnabled() ? Math.round(mc.player.distanceTo(entity)) + "m " : " ";
String devText = (Arrays.asList(Hypnotic.INSTANCE.devUUIDs).contains(entity.getUuidAsString()) ? ColorUtils.purple + " DEV" + ColorUtils.reset : "");
if (name.trim().isEmpty())
name = entity.getName().getString();
if (entity instanceof ItemEntity) {
ItemEntity itemEntity = (ItemEntity) entity;
if (itemEntity.getStack().getCount() > 1)
name += " \247fx" + itemEntity.getStack().getCount();
}
String displayName = "";
if (entity instanceof LivingEntity)
displayName = gameModeText + ColorUtils.white + name.replaceAll(ColorUtils.colorChar, "&") + devText + " " + pingText + distanceText + getHealthString((LivingEntity) entity) + (entity.getName().asString().equalsIgnoreCase("BadGamesInc") ? ColorUtils.purple + " Swag" : "");
return displayName;
}
use of net.minecraft.entity.ItemEntity in project Neutrino by FrostWizard4.
the class WitherlingEntity method dropEquipment.
protected void dropEquipment(DamageSource source, int lootingMultiplier, boolean allowDrops) {
super.dropEquipment(source, lootingMultiplier, allowDrops);
ItemEntity itemEntity = this.dropItem(ItemRegistry.WITHERING_HEART);
if (itemEntity != null) {
itemEntity.setCovetedItem();
}
}
Aggregations