下面列出了net.minecraft.util.Icon#cpw.mods.fml.relauncher.SideOnly 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
/**
* Adds par1*0.15 to the entity's yaw, and *subtracts* par2*0.15 from the pitch. Clamps pitch from -90 to 90. Both
* arguments in degrees.
*/
@SideOnly(Side.CLIENT)
public void setAngles(float p_70082_1_, float p_70082_2_)
{
float f2 = this.rotationPitch;
float f3 = this.rotationYaw;
this.rotationYaw = (float)((double)this.rotationYaw + (double)p_70082_1_ * 0.15D);
this.rotationPitch = (float)((double)this.rotationPitch - (double)p_70082_2_ * 0.15D);
if (this.rotationPitch < -90.0F)
{
this.rotationPitch = -90.0F;
}
if (this.rotationPitch > 90.0F)
{
this.rotationPitch = 90.0F;
}
this.prevRotationPitch += this.rotationPitch - f2;
this.prevRotationYaw += this.rotationYaw - f3;
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister par1IconRegister) {
if (!this.connectedTex) {
this.texture = new IIcon[this.textureNames.length];
for (int i = 0; i < this.textureNames.length; i++) {
this.texture[i] = par1IconRegister.registerIcon(this.textureNames[i]);
}
return;
}
this.texture = new IIcon[this.textureNames.length];
this.connectedTexture = new IIcon[16];
for (int i = 0; i < this.textureNames.length; i++) {
this.texture[i] = par1IconRegister.registerIcon(this.textureNames[i]);
String[] splitname = this.textureNames[0].split(":");
for (int j = 0; j < 16; j++) {
this.connectedTexture[j] = par1IconRegister.registerIcon(
splitname[0]
+ ":connectedTex/"
+ splitname[1] + '/'
+ splitname[1] + '_' + j);
}
}
}
@SideOnly(Side.CLIENT)
public Vec3 getFogColor(float p_76562_1_, float p_76562_2_) {
int i = 10518688;
float f2 = MathHelper.cos(p_76562_1_ * 3.141593F * 2.0F) * 2.0F + 0.5F;
if (f2 < 0.0F) {
f2 = 0.0F;
}
if (f2 > 1.0F) {
f2 = 1.0F;
}
float f3 = (i >> 16 & 0xFF) / 255.0F;
float f4 = (i >> 8 & 0xFF) / 255.0F;
float f5 = (i & 0xFF) / 255.0F;
f3 *= (f2 * 0.0F + 0.15F);
f4 *= (f2 * 0.0F + 0.15F);
f5 *= (f2 * 0.0F + 0.15F);
return Vec3.createVectorHelper(f3, f4, f5);
}
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister aBlockIconRegister) {
for (int i = 0; i < GT_TileEntity_LESU.iTextures.length; i++) {
GT_TileEntity_LESU.iIcons[i] = aBlockIconRegister.registerIcon(MainMod.MOD_ID + ":LESU_CASING_" + i);
int finalI = i;
GT_TileEntity_LESU.iIconContainers[i] = new IIconContainer() {
@Override
public IIcon getIcon() {
return GT_TileEntity_LESU.iIcons[finalI];
}
@Override
public IIcon getOverlayIcon() {
return GT_TileEntity_LESU.iIcons[finalI];
}
@Override
public ResourceLocation getTextureFile() {
return new ResourceLocation(MainMod.MOD_ID + ":LESU_CASING_" + finalI);
}
};
}
}
@SideOnly(Side.CLIENT)
public static void playClientElementEffect(ItemElement.EnumElementType element, World worldObj, double posX, double posY, double posZ) {
float randOffsetX = worldObj.rand.nextFloat() * (worldObj.rand.nextBoolean() ? 1 : -1);
float randOffsetY = worldObj.rand.nextFloat() * (worldObj.rand.nextBoolean() ? 1 : -1);
float randOffsetZ = worldObj.rand.nextFloat() * (worldObj.rand.nextBoolean() ? 1 : -1);
switch (element) {
case DARKNESS:
FXLightningBolt bolt = new FXLightningBolt(Minecraft.getMinecraft().theWorld, posX, posY + 0.2F, posZ,
posX + randOffsetX / 2, posY + randOffsetY / 2, posZ + randOffsetZ / 2, Minecraft.getMinecraft().theWorld.rand.nextLong(), 10, 4.0F, 5);
bolt.defaultFractal();
bolt.setType(5);
bolt.finalizeBolt();
break;
/*case ORDER:
Thaumcraft.proxy.wispFX(worldObj, posX + randOffsetX / 4, posY + 0.2F + randOffsetY / 4, posZ + randOffsetZ / 4, 0.1F, 0xFF, 0xFF, 0xFF);
break;
case FIRE:
Minecraft.getMinecraft().effectRenderer.addEffect(
new EntityFlameFX(worldObj, posX + randOffsetX / 4, posY + 0.2F + randOffsetY / 4, posZ + randOffsetZ / 4, 0, 0, 0));
break;*/
}
}
@SideOnly(Side.CLIENT)
private void initializeBannerData() {
if (patternList == null || colorList == null || field_175121_j == null)
if (!field_175119_g)
field_175121_j = "";
else {
patternList = Lists.newArrayList();
colorList = Lists.newArrayList();
patternList.add(TileEntityBanner.EnumBannerPattern.BASE);
colorList.add(EnumColour.fromDamage(baseColor));
field_175121_j = "b" + baseColor;
if (patterns != null)
for (int i = 0; i < patterns.tagCount(); i++) {
NBTTagCompound nbttagcompound = patterns.getCompoundTagAt(i);
EnumBannerPattern pattern = EnumBannerPattern.getPatternByID(nbttagcompound.getString("Pattern"));
if (pattern != null) {
patternList.add(pattern);
int j = nbttagcompound.getInteger("Color");
colorList.add(EnumColour.fromDamage(j));
field_175121_j = field_175121_j + pattern.getPatternID() + j;
}
}
}
}
@SideOnly(Side.CLIENT)
private void doEssentiaTrail() {
if((ticksExisted & 1) == 0) return;
TileAuraPylon tile = getMasterTile();
if(tile == null) return;
TileAuraPylon inputTile = getInputTile();
if(inputTile == null) return;
Aspect a = inputTile.getAspectType();
if(a == null) return;
if(inputTile.amount <= 0) return;
int count = 5;
FXEssentiaTrail essentiaTrail = new FXEssentiaTrail(tile.getWorldObj(), inputTile.xCoord + 0.5, inputTile.yCoord + 0.2, inputTile.zCoord + 0.5, tile.xCoord + 0.5, tile.yCoord + 1.7, tile.zCoord + 0.5, count, a.getColor(), 1);
essentiaTrail.noClip = true;
essentiaTrail.motionY = (0.1F + MathHelper.sin(count / 3.0F) * 0.01F);
essentiaTrail.motionX = (MathHelper.sin(count / 10.0F) * 0.001F + worldObj.rand.nextGaussian() * 0.002000000094994903D);
essentiaTrail.motionZ = (MathHelper.sin(count / 10.0F) * 0.001F + worldObj.rand.nextGaussian() * 0.002000000094994903D);
ParticleEngine.instance.addEffect(tile.getWorldObj(), essentiaTrail);
}
@Override
@SideOnly(Side.CLIENT)
public boolean func_150936_a(World world, int x, int y, int z, int side, EntityPlayer player, ItemStack stack) {
int i1 = x;
int j1 = y;
int k1 = z;
Block block = world.getBlock(x, y, z);
int meta = world.getBlockMetadata(x, y, z);
if (block == field_150939_a && meta == 2)
return true;
else {
if (side == 0)
y--;
if (side == 1)
y++;
if (side == 2)
z--;
if (side == 3)
z++;
if (side == 4)
x--;
if (side == 5)
x++;
Block block1 = world.getBlock(x, y, z);
return block1 == field_150939_a ? true : super.func_150936_a(world, i1, j1, k1, side, player, stack);
}
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int meta) {
if (ITileHasDifferentTextureSides.class.isAssignableFrom(this.tileEntity)) {
try {
return ((ITileHasDifferentTextureSides) this.tileEntity.newInstance()).getTextureForSide(side, meta);
} catch (InstantiationException | IllegalAccessException e) {
e.printStackTrace();
return super.getIcon(side, meta);
}
} else
return super.getIcon(side, meta);
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister par1IconRegister) {
if (ITileHasDifferentTextureSides.class.isAssignableFrom(this.tileEntity)) {
try {
((ITileHasDifferentTextureSides) this.tileEntity.newInstance()).registerBlockIcons(par1IconRegister);
} catch (InstantiationException | IllegalAccessException e) {
e.printStackTrace();
}
} else
super.registerBlockIcons(par1IconRegister);
}
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void loadTextures(TextureStitchEvent.Pre event) {
if (EtFuturum.enablePrismarine)
if (event.map.getTextureType() == 0) {
TextureAtlasSprite icon = new PrismarineIcon("prismarine_rough");
if (event.map.setTextureEntry("prismarine_rough", icon))
((PrismarineBlocks) ModBlocks.prismarine).setIcon(0, icon);
else
((PrismarineBlocks) ModBlocks.prismarine).setIcon(0, event.map.registerIcon("prismarine_rough"));
}
}
@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockAccess worldClient, int xCoord, int yCoord, int zCoord, int aSide) {
if (worldClient.getBlock(xCoord, yCoord, zCoord) instanceof BW_GlasBlocks)
return false;
return super.shouldSideBeRendered(worldClient, xCoord, yCoord, zCoord, aSide);
}
@Override
@SideOnly(Side.CLIENT)
public ItemStack getRecipeInput() {
if(Minecraft.getMinecraft().thePlayer == null) {
return new ItemStack(Items.cookie);
}
return armorItems[getRecipeInput(new Random(System.currentTimeMillis() / 1000))];
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister reg) {
icons = new IIcon[4];
for (int i = 0; i < icons.length; i++)
icons[i] = reg.registerIcon(getTextureName() + "_stage_" + i);
}
@Override
@SideOnly(Side.CLIENT)
@SuppressWarnings("unchecked")
public void getSubBlocks(Item item, CreativeTabs tab, List list) {
for (int i = 0; i < this.textureNames.length; i++) {
list.add(new ItemStack(item, 1, i));
}
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister par1IconRegister) {
this.texture = new IIcon[this.textureNames.length];
for (int i = 0; i < this.textureNames.length; i++) {
this.texture[i] = par1IconRegister.registerIcon(this.textureNames[i]);
}
}
@Override
@SideOnly(Side.CLIENT)
@SuppressWarnings("unchecked")
public void getSubBlocks(Item item, CreativeTabs tab, List list) {
for (int i = 0; i < this.textureNames.length; i++) {
list.add(new ItemStack(item, 1, i));
}
}
@SideOnly(Side.CLIENT)
@SuppressWarnings("unchecked")
public void getSubItems(Item p_150895_1_, CreativeTabs p_150895_2_, List itemList) {
ItemStack itemStack = new ItemStack(this, 1);
if (this.getChargedItem(itemStack) == this) {
ItemStack charged = new ItemStack(this, 1);
ElectricItem.manager.charge(charged, Integer.MAX_VALUE, Integer.MAX_VALUE, true, false);
itemList.add(charged);
}
if (this.getEmptyItem(itemStack) == this) {
itemList.add(new ItemStack(this, 1, this.getMaxDamage()));
}
}
@Override
@SideOnly(Side.CLIENT)
@SuppressWarnings({ "unchecked", "rawtypes" })
public void getSubItems(Item item, CreativeTabs tab, List subItems) {
for (EnumColour colour : EnumColour.values())
subItems.add(new ItemStack(item, 1, colour.getDamage()));
}
@Override
@SideOnly(Side.CLIENT)
@SuppressWarnings({ "rawtypes", "unchecked" })
public void getSubBlocks(Item item, CreativeTabs tab, List list) {
for (int i = startMeta; i < types.length; i++)
list.add(new ItemStack(item, 1, i));
}
@SideOnly(Side.CLIENT)
public boolean isInRangeToRender3d(double p_145770_1_, double p_145770_3_, double p_145770_5_)
{
double d3 = this.posX - p_145770_1_;
double d4 = this.posY - p_145770_3_;
double d5 = this.posZ - p_145770_5_;
double d6 = d3 * d3 + d4 * d4 + d5 * d5;
return this.isInRangeToRenderDist(d6);
}
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister) {
this.itemIcon = new IIcon[this.tex.length];
for (int i = 0; i < this.tex.length; i++) {
this.itemIcon[i] = iconRegister.registerIcon(MainMod.MOD_ID + ":" + this.tex[i]);
}
}
@SideOnly(Side.CLIENT)
private void playEssentiaEffects() {
if ((ClientHandler.ticks % 20 == 0) && (al.size() > 0)) {
this.displayAspect = al.getAspects()[(ClientHandler.ticks / 20 % al.size())];
Color c = new Color(this.displayAspect.getColor());
this.tr = (c.getRed() / 255.0F);
this.tg = (c.getGreen() / 255.0F);
this.tb = (c.getBlue() / 255.0F);
this.tri = ((this.cr - this.tr) / 20.0F);
this.tgi = ((this.cg - this.tg) / 20.0F);
this.tbi = ((this.cb - this.tb) / 20.0F);
}
if (this.displayAspect == null) {
this.tr = (this.tg = this.tb = 1.0F);
this.tri = (this.tgi = this.tbi = 0.0F);
} else {
this.cr -= this.tri;
this.cg -= this.tgi;
this.cb -= this.tbi;
}
int count = 1;
cr = Math.min(1.0F, Math.max(0.0F, cr));
cg = Math.min(1.0F, Math.max(0.0F, cg));
cb = Math.min(1.0F, Math.max(0.0F, cb));
FXEssentiaTrail essentiaTrail = new FXEssentiaTrail(worldObj, xCoord + 0.5, yCoord + 0.4, zCoord + 0.5, xCoord + 0.5, yCoord + 1.5, zCoord + 0.5, count, new Color(cr, cg, cb).getRGB(), 0.8F);
essentiaTrail.noClip = true;
essentiaTrail.motionY = (0.01F + MathHelper.sin(count / 3.0F) * 0.001F);
essentiaTrail.motionX = (MathHelper.sin(count / 10.0F) * 0.01F + worldObj.rand.nextGaussian() * 0.01D);
essentiaTrail.motionZ = (MathHelper.sin(count / 10.0F) * 0.01F + worldObj.rand.nextGaussian() * 0.01D);
ParticleEngine.instance.addEffect(worldObj, essentiaTrail);
essentiaTrail = new FXEssentiaTrail(worldObj, xCoord + 0.5, yCoord + 2.6, zCoord + 0.5, xCoord + 0.5, yCoord + 1.5, zCoord + 0.5, count, new Color(cr, cg, cb).getRGB(), 0.8F);
essentiaTrail.noClip = true;
essentiaTrail.motionY = -(0.01F + MathHelper.sin(count / 3.0F) * 0.001F);
essentiaTrail.motionX = (MathHelper.sin(count / 10.0F) * 0.01F + worldObj.rand.nextGaussian() * 0.01D);
essentiaTrail.motionZ = (MathHelper.sin(count / 10.0F) * 0.01F + worldObj.rand.nextGaussian() * 0.01D);
ParticleEngine.instance.addEffect(worldObj, essentiaTrail);
}
@Override
@SideOnly(Side.CLIENT)
@SuppressWarnings("unchecked")
public void getSubItems(Item var1, CreativeTabs aCreativeTab, List aList) {
for (Werkstoff werkstoff : werkstoffHashSet) {
if (werkstoff != null && werkstoff.hasItemType(this.orePrefixes)) {
ItemStack tStack = new ItemStack(this, 1, werkstoff.getmID());
aList.add(tStack);
}
}
//super.getSubItems(var1, aCreativeTab, aList);
}
@Override
@SideOnly(Side.CLIENT)
public IMessage onMessage(PacketTCNodeBolt p, MessageContext ctx) {
FXLightningBolt bolt = new FXLightningBolt(Minecraft.getMinecraft().theWorld, p.x, p.y, p.z, p.targetX, p.targetY, p.targetZ, Minecraft.getMinecraft().theWorld.rand.nextLong(), 10, 4.0F, 5);
bolt.defaultFractal();
bolt.setType(p.type);
bolt.finalizeBolt();
return null;
}
/**
* Checks if the entity is in range to render by using the past in distance and comparing it to its average edge
* length * 64 * renderDistanceWeight Args: distance
*/
@SideOnly(Side.CLIENT)
public boolean isInRangeToRenderDist(double p_70112_1_)
{
double d1 = this.boundingBox.getAverageEdgeLength();
d1 *= 64.0D * this.renderDistanceWeight;
return p_70112_1_ < d1 * d1;
}
@SideOnly(Side.CLIENT)
public boolean isMorphed() {
if(methodHasMorph != null) {
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
Boolean result = INJECTOR.invokeMethod(methodHasMorph, player.getCommandSenderName(), true);
return result != null ? result : false;
}
return false;
}
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onWorldUnload(WorldEvent.Unload event) {
if (!event.world.isRemote) return;
// When we unload a world client side, we want to make sure that any view entities clean up. Not strictly necessary, but a good practice.
// I don't trust vanilla to unload entity references quickly/correctly/completely.
for (Object entity : event.world.loadedEntityList) {
if (entity instanceof EntityPortal) ((EntityPortal) entity).releaseActiveView();
}
}
@Override
@SideOnly(Side.CLIENT)
public AxisAlignedBB getSelectedBoundingBoxFromPool(World pWorld, int pX, int pY, int pZ)
{
setBlockBoundsBasedOnState(pWorld, pX, pY, pZ);
return super.getSelectedBoundingBoxFromPool(pWorld, pX, pY, pZ);
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconRegister)
{
for (int i = 0; i < 47; i++) {
textures[i] = iconRegister.registerIcon(String.format("%s:sets/atlantis/%s/forgeCtm_%d", Refstrings.MODID.toLowerCase(), _mInternalName.toLowerCase(), i + 1));
}
}