本文整理汇总了Java中net.minecraft.entity.passive.EntitySheep类的典型用法代码示例。如果您正苦于以下问题:Java EntitySheep类的具体用法?Java EntitySheep怎么用?Java EntitySheep使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
EntitySheep类属于net.minecraft.entity.passive包,在下文中一共展示了EntitySheep类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: itemInteractionForEntity
import net.minecraft.entity.passive.EntitySheep; //导入依赖的package包/类
/**
* Returns true if the item can be used on the given entity, e.g. shears on sheep.
*/
public boolean itemInteractionForEntity(ItemStack stack, EntityPlayer playerIn, EntityLivingBase target)
{
if (target instanceof EntitySheep)
{
EntitySheep entitysheep = (EntitySheep)target;
EnumDyeColor enumdyecolor = EnumDyeColor.byDyeDamage(stack.getMetadata());
if (!entitysheep.getSheared() && entitysheep.getFleeceColor() != enumdyecolor)
{
entitysheep.setFleeceColor(enumdyecolor);
--stack.stackSize;
}
return true;
}
else
{
return false;
}
}
示例2: dropEvent
import net.minecraft.entity.passive.EntitySheep; //导入依赖的package包/类
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void dropEvent(LivingDropsEvent event) {
if (event.entityLiving.worldObj.isRemote)
return;
if (EtFuturum.enableSkullDrop)
dropHead(event.entityLiving, event.source, event.lootingLevel, event.drops);
Random rand = event.entityLiving.worldObj.rand;
if (EtFuturum.enableMutton && event.entityLiving instanceof EntitySheep) {
int amount = rand.nextInt(3) + 1 + rand.nextInt(1 + event.lootingLevel);
for (int i = 0; i < amount; i++)
if (event.entityLiving.isBurning())
addDrop(new ItemStack(ModItems.cooked_mutton), event.entityLiving, event.drops);
else
addDrop(new ItemStack(ModItems.raw_mutton), event.entityLiving, event.drops);
}
}
示例3: BiomeTundra
import net.minecraft.entity.passive.EntitySheep; //导入依赖的package包/类
public BiomeTundra() {
super(new BiomeProperties("Tundra")
.setBaseHeight(0.325f)
.setHeightVariation(0.05f)
.setTemperature(0.2f) // 0.25f
.setRainfall(0.45f)
);
this.setRegistryName(Ref.MODID+":steppe");
this.decorator.treesPerChunk = 1;
this.decorator.grassPerChunk = 10;
this.decorator.flowersPerChunk = 2;
this.decorator.reedsPerChunk = -999;
this.decorator.cactiPerChunk = -999;
this.spawnableCreatureList.clear();
this.spawnableCreatureList.add(new Biome.SpawnListEntry(EntityRabbit.class, 10, 2, 3));
this.spawnableCreatureList.add(new Biome.SpawnListEntry(EntitySheep.class, 12, 1, 5));
Ref.BIOMES.add(this);
}
示例4: onSheared
import net.minecraft.entity.passive.EntitySheep; //导入依赖的package包/类
@SubscribeEvent
public void onSheared(EntityInteractSpecific event) {
ItemStack rainbow = BaublesApi.getBaublesHandler((EntityPlayer)event.getEntityPlayer()).getStackInSlot(6);
if (rainbow == null || (rainbow != null && rainbow.getItem() != this)) return;
if (!(event.getTarget() instanceof IShearable)) return;
if (!(event.getTarget() instanceof EntitySheep) || (event.getTarget() instanceof EntitySheep && ((EntitySheep)event.getTarget()).getSheared())) return;
if (event.getItemStack() == null || (event.getItemStack() != null && !(event.getItemStack().getItem() instanceof ItemShears))) return;
int fortune = EnchantmentHelper.getEnchantmentLevel(Enchantments.FORTUNE, event.getItemStack());
if (!event.getWorld().isRemote) {
List<ItemStack> wools = ((IShearable)event.getTarget()).onSheared(event.getItemStack(), event.getWorld(), event.getPos(), fortune);
for (ItemStack is : wools) {
Random rand = new Random();
is.setItemDamage(rand.nextInt(15));
EntityItem wool = new EntityItem(event.getWorld(), event.getTarget().posX, event.getTarget().posY, event.getTarget().posZ, is);
event.getWorld().spawnEntityInWorld(wool);
}
}
}
示例5: itemInteractionForEntity
import net.minecraft.entity.passive.EntitySheep; //导入依赖的package包/类
/**
* Returns true if the item can be used on the given entity, e.g. shears on sheep.
*/
public boolean itemInteractionForEntity(ItemStack stack, EntityPlayer playerIn, EntityLivingBase target, EnumHand hand)
{
if (target instanceof EntitySheep)
{
EntitySheep entitysheep = (EntitySheep)target;
EnumDyeColor enumdyecolor = EnumDyeColor.byDyeDamage(stack.getMetadata());
if (!entitysheep.getSheared() && entitysheep.getFleeceColor() != enumdyecolor)
{
entitysheep.setFleeceColor(enumdyecolor);
stack.func_190918_g(1);
}
return true;
}
else
{
return false;
}
}
示例6: doRenderLayer
import net.minecraft.entity.passive.EntitySheep; //导入依赖的package包/类
public void doRenderLayer(EntityWolf entitylivingbaseIn, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale)
{
if (entitylivingbaseIn.isTamed() && !entitylivingbaseIn.isInvisible())
{
this.wolfRenderer.bindTexture(WOLF_COLLAR);
float[] afloat = EntitySheep.getDyeRgb(entitylivingbaseIn.getCollarColor());
if (Config.isCustomColors())
{
afloat = CustomColors.getWolfCollarColors(entitylivingbaseIn.getCollarColor(), afloat);
}
GlStateManager.color(afloat[0], afloat[1], afloat[2]);
this.wolfRenderer.getMainModel().render(entitylivingbaseIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale);
}
}
示例7: renderTileEntityAt
import net.minecraft.entity.passive.EntitySheep; //导入依赖的package包/类
public void renderTileEntityAt(TileEntityEndPortal te, double x, double y, double z, float partialTicks, int destroyStage)
{
GlStateManager.disableFog();
TileEntityEndGateway tileentityendgateway = (TileEntityEndGateway)te;
if (tileentityendgateway.isSpawning() || tileentityendgateway.isCoolingDown())
{
GlStateManager.alphaFunc(516, 0.1F);
this.bindTexture(END_GATEWAY_BEAM_TEXTURE);
float f = tileentityendgateway.isSpawning() ? tileentityendgateway.getSpawnPercent(partialTicks) : tileentityendgateway.getCooldownPercent(partialTicks);
double d0 = tileentityendgateway.isSpawning() ? 256.0D - y : 50.0D;
f = MathHelper.sin(f * (float)Math.PI);
int i = MathHelper.floor((double)f * d0);
float[] afloat = EntitySheep.getDyeRgb(tileentityendgateway.isSpawning() ? EnumDyeColor.MAGENTA : EnumDyeColor.PURPLE);
TileEntityBeaconRenderer.renderBeamSegment(x, y, z, (double)partialTicks, (double)f, (double)tileentityendgateway.getWorld().getTotalWorldTime(), 0, i, afloat, 0.15D, 0.175D);
TileEntityBeaconRenderer.renderBeamSegment(x, y, z, (double)partialTicks, (double)f, (double)tileentityendgateway.getWorld().getTotalWorldTime(), 0, -i, afloat, 0.15D, 0.175D);
}
super.renderTileEntityAt(te, x, y, z, partialTicks, destroyStage);
GlStateManager.enableFog();
}
示例8: itemInteractionForEntity
import net.minecraft.entity.passive.EntitySheep; //导入依赖的package包/类
/**
* Returns true if the item can be used on the given entity, e.g. shears on sheep.
*/
public boolean itemInteractionForEntity(ItemStack stack, EntityPlayer playerIn, EntityLivingBase target, EnumHand hand)
{
if (target instanceof EntitySheep)
{
EntitySheep entitysheep = (EntitySheep)target;
EnumDyeColor enumdyecolor = EnumDyeColor.byDyeDamage(stack.getMetadata());
if (!entitysheep.getSheared() && entitysheep.getFleeceColor() != enumdyecolor)
{
entitysheep.setFleeceColor(enumdyecolor);
--stack.stackSize;
}
return true;
}
else
{
return false;
}
}
示例9: initSockLists
import net.minecraft.entity.passive.EntitySheep; //导入依赖的package包/类
private static void initSockLists() {
if (socksOrdered == null) {
socksOrdered = new ArrayList<>(256);
for (int i = 0; i < 256; i++) {
ItemStack sock = new ItemStack(PonySocks.sock, 1, 0);
sock.setTagCompound(new NBTTagCompound());
sock.getTagCompound().setInteger("color1", RecipeDyeableBase.fromFloats(EntitySheep.getDyeRgb(EnumDyeColor.byMetadata(i & 15))));
sock.getTagCompound().setInteger("color2", RecipeDyeableBase.fromFloats(EntitySheep.getDyeRgb(EnumDyeColor.byMetadata(i >> 4))));
socksOrdered.add(sock);
}
socksShuffled = Lists.newArrayList(socksOrdered);
Collections.shuffle(socksShuffled);
}
}
示例10: renderEquippedGlove
import net.minecraft.entity.passive.EntitySheep; //导入依赖的package包/类
@SubscribeEvent
public void renderEquippedGlove(final RenderPlayerEvent.Specials.Post event) {
if (event.entityPlayer == null) {
return;
}
final ItemStack heldItem = event.entityPlayer.getHeldItem();
if (heldItem == null || heldItem.getItem() != ExtraUtils.glove) {
return;
}
final int dmg = heldItem.getItemDamage();
final RenderPlayer renderplayer = event.renderer;
float[] col = EntitySheep.fleeceColorTable[ItemGlove.getColIndex(1, dmg)];
GL11.glColor3f(col[0], col[1], col[2]);
Minecraft.getMinecraft().getTextureManager().bindTexture(RenderItemGlove.glove1);
renderplayer.modelBipedMain.bipedRightArm.render(0.0625f);
col = EntitySheep.fleeceColorTable[ItemGlove.getColIndex(0, dmg)];
GL11.glColor3f(col[0], col[1], col[2]);
Minecraft.getMinecraft().getTextureManager().bindTexture(RenderItemGlove.glove2);
renderplayer.modelBipedMain.bipedRightArm.render(0.0625f);
}
示例11: onBehaviourStarted
import net.minecraft.entity.passive.EntitySheep; //导入依赖的package包/类
@Override
public void onBehaviourStarted(BlockPos currentPos) {
if (type != ChanceCubeType.GIANT) return;
EntitySheep entity = getEntity();
World worldObj = entity.worldObj;
final int distance = ChanceCubesConfiguration.distance.getInt();
ShearMadnessMod.CHANNEL.sendToAllAround(
new PlayCustomSoundMessage(
entity.posX, entity.posY, entity.posZ,
ChanceCubeSounds.chancecube_giantcubespawned, SoundCategory.NEUTRAL,
0.3F, 1.0f,
true
),
new NetworkRegistry.TargetPoint(
worldObj.provider.getDimension(),
entity.posX, entity.posY, entity.posZ,
distance
)
);
}
示例12: onInteraction
import net.minecraft.entity.passive.EntitySheep; //导入依赖的package包/类
@SubscribeEvent
public static void onInteraction(ShearMadnessSpecialInteractionEvent event) {
final ItemStack itemStack = event.getItemStack();
final EntitySheep sheep = event.getSheep();
final EntityPlayer player = event.getPlayer();
if (ItemStackHelper.isStackForBlock(itemStack, Blocks.ANVIL)) {
player.displayGui(new AnvilInteraction(event.getWorld(), sheep));
}
if (ItemStackHelper.isStackForBlock(itemStack, Blocks.CRAFTING_TABLE)) {
player.displayGui(new WorkbenchInteraction(event.getWorld(), sheep));
}
if (ItemStackHelper.isStackForBlock(itemStack, Blocks.ENCHANTING_TABLE)) {
player.displayGui(new EnchantmentInteraction(event.getWorld(), sheep));
}
if (ItemStackHelper.isStackForBlock(itemStack, Blocks.NOTEBLOCK)) {
NoteBlockBehaviour.tuneNoteBlockSheep(event.getSheep());
}
}
示例13: shearSheep
import net.minecraft.entity.passive.EntitySheep; //导入依赖的package包/类
public static void shearSheep(ItemStack itemStack, EntitySheep sheep, IChiseledSheepCapability capability)
{
if (Settings.Shearing.getBehaviour() == ShearBehaviour.CannotShear) {
//TODO: Play shear cancelled Sound.
return;
}
sheep.setSheared(true);
//TODO: Add support for facade drop.
//Select the item to drop.
final ItemStack itemToDrop = capability.getChiselItemStack().copy();
itemToDrop.stackSize = 1;
ItemStackUtils.dropItem(sheep, itemToDrop);
sheep.playSound(SoundEvents.ENTITY_SHEEP_SHEAR, 1.0F, 1.0F);
itemStack.damageItem(1, sheep);
if (Settings.Shearing.getBehaviour() == ShearBehaviour.RevertSheep) {
capability.unChisel();
CHANNEL.sendToAll(new SheepChiseledMessage(sheep));
}
}
示例14: EntityZombieDog
import net.minecraft.entity.passive.EntitySheep; //导入依赖的package包/类
public EntityZombieDog(World world, boolean isHusk) {
super(world);
this.setMobType(isHusk ? EnumUndeadMobType.HUSK : EnumUndeadMobType.ZOMBIE);
((PathNavigateGround) this.getNavigator()).setCanSwim(true);
this.tasks.addTask(1, new EntityAISwimming(this));
this.tasks.addTask(2, new EntityAIAttackMelee(this, 1, false));
this.tasks.addTask(4, new EntityAIMoveTowardsRestriction(this, 1));
this.tasks.addTask(6, new EntityAIWander(this, 1));
this.tasks.addTask(5, new EntityAIMoveThroughVillage(this, 1, false));
this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityVillager.class, false));
if (ExtendedConfig.zombiePetsAttackPets) {
this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityWolf.class, false));
this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityOcelot.class, false));
}
this.targetTasks.addTask(4, new EntityAINearestAttackableHorse(this, false));
if (ExtendedConfig.zombiePetsAttackAnimals) {
this.targetTasks.addTask(4, new EntityAINearestAttackableTarget(this, EntitySheep.class, false));
}
}
示例15: onLivingDrops
import net.minecraft.entity.passive.EntitySheep; //导入依赖的package包/类
@SubscribeEvent
public void onLivingDrops(LivingDropsEvent event)
{
Entity e = event.entity;
List<EntityItem> drops = event.drops;
// Remove all drops from cows, sheep and pigs, add carcass drop
if (e instanceof EntityCow || e instanceof EntityPig || e instanceof EntitySheep)
{
EntityAnimal a = (EntityAnimal) e;
Iterator<EntityItem> it = drops.iterator();
while (it.hasNext())
{
EntityItem i = it.next();
it.remove();
}
if (a.getGrowingAge() == 0)
{
if (a instanceof EntityCow) a.dropItem(TanneryItems.bloodyCowCarcass, 1);
else if (a instanceof EntityPig) a.dropItem(TanneryItems.bloodyPigCarcass, 1);
else if (a instanceof EntitySheep) a.dropItem(TanneryItems.bloodySheepCarcass, 1);
}
}
}