本文整理汇总了Java中me.ichun.mods.ichunutil.common.core.util.EntityHelper类的典型用法代码示例。如果您正苦于以下问题:Java EntityHelper类的具体用法?Java EntityHelper怎么用?Java EntityHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EntityHelper类属于me.ichun.mods.ichunutil.common.core.util包,在下文中一共展示了EntityHelper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onPlayerLogin
import me.ichun.mods.ichunutil.common.core.util.EntityHelper; //导入依赖的package包/类
@SubscribeEvent
public void onPlayerLogin(PlayerEvent.PlayerLoggedInEvent event)
{
NBTTagCompound tag = EntityHelper.getPlayerPersistentData(event.player, "GuiltTripSave");
int size = tag.getInteger("size");
for(int i = 0; i < size; i++)
{
ArrayList<KillInfo> kills = GuiltTrip.eventHandlerServer.playerKills.get(event.player.getName());
if(kills == null)
{
kills = new ArrayList<>();
GuiltTrip.eventHandlerServer.playerKills.put(event.player.getName(), kills);
}
kills.add(KillInfo.createKillInfoFromTag(tag.getCompoundTag("kill_" + i)));
}
GuiltTrip.eventHandlerServer.updatePlayersOnKill(event.player.getName(), null);
GuiltTrip.eventHandlerServer.updatePlayersOnKill(null, event.player.getName());
}
示例2: handlePerspective
import me.ichun.mods.ichunutil.common.core.util.EntityHelper; //导入依赖的package包/类
@Override
public Pair<? extends IBakedModel, Matrix4f> handlePerspective(ItemCameraTransforms.TransformType cameraTransformType)
{
currentPerspective = cameraTransformType;
Pair<? extends IBakedModel, Matrix4f> pair = modelBase.handlePerspective(cameraTransformType, selfPair);
if(modelBase.useVanillaCameraTransform())
{
boolean isLeft = isLeftHand(cameraTransformType);
if(isItemDualHanded && isFirstPerson(currentPerspective) && lastEntity instanceof EntityPlayer && ItemRenderingHelper.dualHandedAnimationRight > 0)
{
float prog = (float)Math.sin(MathHelper.clamp((isLeft ? EntityHelper.interpolateValues(ItemRenderingHelper.prevDualHandedAnimationLeft, ItemRenderingHelper.dualHandedAnimationLeft, iChunUtil.eventHandlerClient.renderTick) : EntityHelper.interpolateValues(ItemRenderingHelper.prevDualHandedAnimationRight, ItemRenderingHelper.dualHandedAnimationRight, iChunUtil.eventHandlerClient.renderTick)) / (float)ItemRenderingHelper.dualHandedAnimationTime, 0F, 1F) * Math.PI / 4F);
GlStateManager.rotate(30F * prog, -1F, 0F, 0F);
GlStateManager.translate(0F, -0.1F * prog, 0.3F * prog);
GlStateManager.rotate((isLeft ? -35F : 35F) * prog, 0F, 1F, 0F);
}
ItemCameraTransforms.applyTransformSide(this.getItemCameraTransforms().getTransform(cameraTransformType), isLeft);
}
return pair;
}
示例3: getRollFactor
import me.ichun.mods.ichunutil.common.core.util.EntityHelper; //导入依赖的package包/类
public static float getRollFactor(int level, float partialTick)
{
if(level <= 0)
{
return EntityHelper.interpolateValues(WorldPortals.eventHandlerClient.prevCameraRoll, WorldPortals.eventHandlerClient.cameraRoll, partialTick);
}
else if(level <= rollFactor.size())
{
float roll = EntityHelper.interpolateValues(WorldPortals.eventHandlerClient.prevCameraRoll, WorldPortals.eventHandlerClient.cameraRoll, partialTick);
for(int i = level - 1; i >= 0 ; i--)
{
roll += rollFactor.get(i);
}
return roll;
}
return 0F;
}
示例4: terminate
import me.ichun.mods.ichunutil.common.core.util.EntityHelper; //导入依赖的package包/类
public void terminate()
{
if(isAgainstWall())
{
for(Entity ent : lastScanEntities)
{
if(ent.getEntityBoundingBox().intersects(portalInsides))
{
EnumFacing faceOn = getFaceOn();
EntityHelper.putEntityWithinAABB(ent, flatPlane.offset(faceOn.getFrontOffsetX() * 0.5D, faceOn.getFrontOffsetY() * 0.5D, faceOn.getFrontOffsetZ() * 0.5D));
ent.setPosition(ent.posX, ent.posY, ent.posZ);
}
WorldPortals.eventHandler.removeMonitoredEntity(ent, this);
}
}
if(hasPair())
{
pair.setPair(null);
setPair(null);
}
}
示例5: onItemRightClick
import me.ichun.mods.ichunutil.common.core.util.EntityHelper; //导入依赖的package包/类
@Override
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand)
{
// player.setActiveHand(hand);
if(ItemHandler.getUsableDualHandedItem(player) == player.getHeldItem(hand) && (player.capabilities.isCreativeMode || EntityHelper.consumeInventoryItem(player.inventory, Torched.itemTorchFirework, 1, 1)))
{
Torched.proxy.nudgeHand(player);
if(!world.isRemote)
{
EntityHelper.playSoundAtEntity(player, Torched.soundRPT, SoundCategory.PLAYERS, 1.0F, 0.9F + (player.getRNG().nextFloat() * 2F - 1F) * 0.075F);
player.world.spawnEntity(new EntityTorchFirework(player.world, player));
}
}
return new ActionResult(EnumActionResult.PASS, player.getHeldItem(hand));
}
示例6: shootTorch
import me.ichun.mods.ichunutil.common.core.util.EntityHelper; //导入依赖的package包/类
public void shootTorch(EntityPlayer player)
{
playerDelay.put(player.getName(), 5);
ItemStack is = ItemHandler.getUsableDualHandedItem(player);
if(player.capabilities.isCreativeMode || is.getItem() instanceof ItemTorchGun && is.getItemDamage() < is.getMaxDamage() && EntityHelper.consumeInventoryItem(player.inventory, Item.getItemFromBlock(Blocks.TORCH)))
{
if(!player.capabilities.isCreativeMode)
{
is.setItemDamage(is.getItemDamage() + 1);
player.inventory.markDirty();
}
EntityHelper.playSoundAtEntity(player, Torched.soundTube, SoundCategory.PLAYERS, 0.5F, 0.85F + (player.getRNG().nextFloat() * 2F - 1F) * 0.075F);
player.world.spawnEntity(new EntityTorch(player.world, player));
}
}
示例7: doRender
import me.ichun.mods.ichunutil.common.core.util.EntityHelper; //导入依赖的package包/类
@Override
public void doRender(EntityGib gib, double par2, double par4, double par6, float par8, float par9)
{
GlStateManager.disableCull();
GlStateManager.pushMatrix();
bindEntityTexture(gib);
GlStateManager.enableBlend();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GlStateManager.color(1.0F, 1.0F, 1.0F, MathHelper.clamp(gib.groundTime >= MobDismemberment.config.gibGroundTime ? 1.0F - (gib.groundTime - MobDismemberment.config.gibGroundTime + par9) / 20F : 1.0F, 0F, 1F));
GlStateManager.alphaFunc(GL11.GL_GREATER, 0.003921569F);
GlStateManager.translate(par2, par4, par6);
GlStateManager.translate(0.0F, gib.type == 0 ? 4F / 16F : gib.type <= 2 && gib.parent instanceof EntitySkeleton ? 1F / 16F : 2F / 16F, 0.0F);
GlStateManager.rotate(EntityHelper.interpolateRotation(gib.prevRotationYaw, gib.rotationYaw, par9), 0.0F, 1.0F, 0.0F);
GlStateManager.rotate(EntityHelper.interpolateRotation(gib.prevRotationPitch, gib.rotationPitch, par9), -1.0F, 0.0F, 0.0F);
GlStateManager.translate(0.0F, 24F / 16F - gib.height * 0.5F, 0.0F);
GlStateManager.scale(-1.0F, -1.0F, 1.0F);
modelGib.render(gib, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
GlStateManager.alphaFunc(GL11.GL_GREATER, 0.1F);
GlStateManager.disableBlend();
GlStateManager.popMatrix();
GlStateManager.enableCull();
}
示例8: doRender
import me.ichun.mods.ichunutil.common.core.util.EntityHelper; //导入依赖的package包/类
@Override
public void doRender(EntityGib gib, double par2, double par4, double par6, float par8, float par9)
{
if(!gib.attached)
{
GlStateManager.disableCull();
GlStateManager.pushMatrix();
bindEntityTexture(gib);
GlStateManager.enableBlend();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GlStateManager.color(1.0F, 1.0F, 1.0F, MathHelper.clamp(gib.groundTime >= MobAmputation.config.gibGroundTime ? 1.0F - (gib.groundTime - MobAmputation.config.gibGroundTime + par9) / 20F : 1.0F, 0F, 1F));
GlStateManager.alphaFunc(GL11.GL_GREATER, 0.003921569F);
GlStateManager.translate(par2, par4, par6);
GlStateManager.translate(0.0F, gib.type == 0 ? 4F / 16F : gib.type <= 2 && gib.parent instanceof EntitySkeleton ? 1F / 16F : 2F / 16F, 0.0F);
GlStateManager.rotate(EntityHelper.interpolateRotation(gib.prevRotationYaw, gib.rotationYaw, par9), 0.0F, 1.0F, 0.0F);
GlStateManager.rotate(EntityHelper.interpolateRotation(gib.prevRotationPitch, gib.rotationPitch, par9), -1.0F, 0.0F, 0.0F);
GlStateManager.translate(0.0F, 24F / 16F - gib.height * 0.5F, 0.0F);
GlStateManager.scale(-1.0F, -1.0F, 1.0F);
modelGib.render(gib, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
GlStateManager.alphaFunc(GL11.GL_GREATER, 0.1F);
GlStateManager.disableBlend();
GlStateManager.popMatrix();
GlStateManager.enableCull();
}
}
示例9: attachGibs
import me.ichun.mods.ichunutil.common.core.util.EntityHelper; //导入依赖的package包/类
public void attachGibs(World world, EntityLivingBase living)
{
EntityHelper.setSize(living.getClass(), living, 0.4F, 1.5F);
living.setPosition(living.posX, living.posY, living.posZ);
EntityGib[] gibs = new EntityGib[3];
for(int i = 0; i <= 2; i++)
{
gibs[i] = new EntityGib(world, living, i);
world.spawnEntity(gibs[i]);
}
amputationMap.put(living, gibs);
}
示例10: onClientTick
import me.ichun.mods.ichunutil.common.core.util.EntityHelper; //导入依赖的package包/类
@SubscribeEvent
public void onClientTick(TickEvent.ClientTickEvent event)
{
if(event.phase == TickEvent.Phase.END)
{
Minecraft mc = Minecraft.getMinecraft();
if(mc.world != null && !mc.isGamePaused())
{
prevYaw = currentYaw;
prevPitch = currentPitch;
currentYaw = EntityHelper.updateRotation(currentYaw, targetYaw, 10F);
currentPitch = EntityHelper.updateRotation(currentPitch, targetPitch, 10F);
if(pullTime > 0)
{
if(!(pressState.contains(mc.player.getName()) && pullTime == 7))
{
pullTime--;
}
idleTime = 0;
prevYaw = prevPitch = currentYaw = currentPitch = targetYaw = targetPitch = 0F;
}
else
{
idleTime++;
if(idleTime > 60) //3 second idle.
{
if(mc.world.rand.nextFloat() < 0.008F)
{
targetYaw = mc.world.rand.nextFloat() * 90F - 45F;
targetPitch = mc.world.rand.nextFloat() * 60F - 30F;
}
}
}
}
}
}
示例11: onLeftClickEntity
import me.ichun.mods.ichunutil.common.core.util.EntityHelper; //导入依赖的package包/类
@Override
public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity)
{
if(player.world.isRemote)
{
iChunUtil.proxy.nudgeHand(-50F);
}
EntityHelper.playSoundAtEntity(entity, SoundEvents.ENTITY_GENERIC_EAT, SoundCategory.NEUTRAL, 0.6F, (entity.world.rand.nextFloat() - entity.world.rand.nextFloat()) * 0.2F + 1F);
return false;
}
示例12: execute
import me.ichun.mods.ichunutil.common.core.util.EntityHelper; //导入依赖的package包/类
@Override
public void execute(Side side, EntityPlayer player)
{
if(pressed)
{
ItemStack is = ItemHandler.getUsableDualHandedItem(player);
if(is.getItem() == BeeBarker.itemBeeBarker && is.getTagCompound() != null && is.getTagCompound().hasKey(ItemBeeBarker.WOLF_DATA_STRING))
{
if(BeeBarker.config.easterEgg == 1 && ((NBTTagCompound)is.getTagCompound().getTag(ItemBeeBarker.WOLF_DATA_STRING)).hasKey("CustomName") && ((NBTTagCompound)is.getTagCompound().getTag(ItemBeeBarker.WOLF_DATA_STRING)).getString("CustomName").equals("iChun"))
{
if(!BarkHelper.pressState.contains(player.getName()))
{
BarkHelper.pressState.add(player.getName());
EntityHelper.playSoundAtEntity(player, SoundEvents.ENTITY_WOLF_GROWL, SoundCategory.PLAYERS, 0.4F, 1.0F);
BeeBarker.channel.sendToAll(new PacketKeyState(player.getName(), true));
}
}
else
{
BarkHelper.bark(player);
}
}
}
else
{
BarkHelper.removePressState(player.getName());
}
}
示例13: createKillInfoFromEntity
import me.ichun.mods.ichunutil.common.core.util.EntityHelper; //导入依赖的package包/类
public static KillInfo createKillInfoFromEntity(EntityLivingBase living)
{
NBTTagCompound tag = new NBTTagCompound();
if(living instanceof EntityPlayer || living.writeToNBTOptional(tag))
{
KillInfo info = new KillInfo();
if(living instanceof EntityPlayer)
{
NBTTagCompound persistent = EntityHelper.getPlayerPersistentData((EntityPlayer)living);
NBTTagCompound tempTag = persistent.getCompoundTag("GuiltTripSave");
persistent.setTag("GuiltTripSave", new NBTTagCompound());
living.writeToNBT(tag);
tag = tag.copy();
persistent.setTag("GuiltTripSave", tempTag);
info.playerName = living.getName();
}
tag.setShort("HurtTime", (short)0);
tag.setShort("DeathTime", (short)0);
tag.setFloat("HealF", 1);
tag.setShort("Health", (short)1);
info.tag = tag;
return info;
}
return null;
}
示例14: drawMap
import me.ichun.mods.ichunutil.common.core.util.EntityHelper; //导入依赖的package包/类
public void drawMap(Minecraft mc, ScaledResolution reso, int x, int y, int width, int height, float aScale, float partialTicks)
{
double posX = x + width * (float)Blocksteps.config.camPosX / 100F;
double posY = y + height * (float)Blocksteps.config.camPosY / 100F;
EntityLivingBase ent = mc.thePlayer;
GlStateManager.enableColorMaterial();
GlStateManager.pushMatrix();
GlStateManager.translate((float)posX, (float)posY, 300.0F);
if(fullscreen)
{
GlStateManager.translate(EntityHelper.interpolateValues(prevOffsetX, offsetX, partialTicks), EntityHelper.interpolateValues(prevOffsetY, offsetY, partialTicks), 0F);
}
GlStateManager.scale(-aScale, aScale, aScale);
GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F);
GlStateManager.rotate(EntityHelper.interpolateRotation(prevAngleX, angleX, partialTicks), 1.0F, 0.0F, 0.0F);
GlStateManager.rotate(EntityHelper.interpolateRotation(prevAngleY, angleY, partialTicks), 0.0F, 1.0F, 0.0F);
GlStateManager.translate(0, -mc.thePlayer.getEyeHeight(), 0F);
boolean hideGui = mc.gameSettings.hideGUI;
mc.gameSettings.hideGUI = Blocksteps.config.hideNamePlates == 1;
renderWorld(mc, partialTicks);
mc.gameSettings.hideGUI = hideGui;
GlStateManager.enableLighting();
GlStateManager.enableNormalize();
GlStateManager.popMatrix();
RenderHelper.disableStandardItemLighting();
}
示例15: readFromNBT
import me.ichun.mods.ichunutil.common.core.util.EntityHelper; //导入依赖的package包/类
@Override
public void readFromNBT(NBTTagCompound tag)
{
super.readFromNBT(tag);
hasBase = tag.getBoolean("hasBase");
head = tag.getInteger("head");
hasStand = tag.getBoolean("hasStand");
isOnFloor = tag.getBoolean("isOnFloor");
orientation = tag.getInteger("orientation");
sideOn = tag.getInteger("sideOn");
if(head == 4)
{
if(tag.hasKey("headName") && !tag.getString("headName").isEmpty())
{
this.gameProfile = EntityHelper.getGameProfile(tag.getString("headName"));
}
else if (tag.hasKey("headNameProfile", 10))
{
this.gameProfile = NBTUtil.readGameProfileFromNBT(tag.getCompoundTag("headNameProfile"));
}
}
hatName = tag.getString("hatName");
colourR = tag.getInteger("colourR");
colourG = tag.getInteger("colourG");
colourB = tag.getInteger("colourB");
alpha = tag.getInteger("alpha");
if(alpha == 0)
{
alpha = 255;
}
info = new HatInfoClient(hatName, colourR, colourG, colourB, alpha);
}