mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-26 15:03:14 +00:00
Improve code readability in binnie.extrabees package and other packages
* Improve code readability in binnie.extrabees package and other packages * Fix compile error after refactoring
This commit is contained in:
1 parent
b609d6688f
commit
c09ad04284
95 files changed
+3916
-3900
No files matched your search
@@ -1,38 +1,34 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.extrabees.genetics.effect;
|
||||
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import java.util.Random;
|
||||
import binnie.extrabees.ExtraBees;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import binnie.extrabees.ExtraBees;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.block.BlockWeb;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockEctoplasm extends BlockWeb {
|
||||
public BlockEctoplasm() {
|
||||
setLightOpacity(1);
|
||||
setHardness(0.5f);
|
||||
}
|
||||
|
||||
public class BlockEctoplasm extends BlockWeb
|
||||
{
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(final IIconRegister register) {
|
||||
this.blockIcon = ExtraBees.proxy.getIcon(register, "ectoplasm");
|
||||
}
|
||||
|
||||
public BlockEctoplasm() {
|
||||
this.setLightOpacity(1);
|
||||
this.setHardness(0.5f);
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
blockIcon = ExtraBees.proxy.getIcon(register, "ectoplasm");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int quantityDropped(final Random rand) {
|
||||
public int quantityDropped(Random rand) {
|
||||
return (rand.nextInt(5) == 0) ? 1 : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(final int p_149650_1_, final Random p_149650_2_, final int p_149650_3_) {
|
||||
public Item getItemDropped(int meta, Random rand, int fortune) {
|
||||
return Items.slime_ball;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,60 +1,56 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.extrabees.genetics.effect;
|
||||
|
||||
import java.util.List;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.effect.EntityLightningBolt;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.entity.effect.EntityLightningBolt;
|
||||
|
||||
public class EntityBeeLightning extends EntityLightningBolt
|
||||
{
|
||||
import java.util.List;
|
||||
|
||||
public class EntityBeeLightning extends EntityLightningBolt {
|
||||
int lightningState;
|
||||
int boltLivingTime;
|
||||
|
||||
public EntityBeeLightning(final World par1World, final double par2, final double par4, final double par6) {
|
||||
public EntityBeeLightning(World par1World, double par2, double par4, double par6) {
|
||||
super(par1World, par2, par4, par6);
|
||||
this.lightningState = 2;
|
||||
this.boltLivingTime = this.rand.nextInt(3) + 1;
|
||||
lightningState = 2;
|
||||
boltLivingTime = rand.nextInt(3) + 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
this.onEntityUpdate();
|
||||
--this.lightningState;
|
||||
if (this.lightningState < 0) {
|
||||
if (this.boltLivingTime == 0) {
|
||||
this.setDead();
|
||||
}
|
||||
else if (this.lightningState < -this.rand.nextInt(10)) {
|
||||
--this.boltLivingTime;
|
||||
this.lightningState = 1;
|
||||
this.boltVertex = this.rand.nextLong();
|
||||
if (!this.worldObj.isRemote && this.worldObj.doChunksNearChunkExist(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ), 10)) {
|
||||
final int i = MathHelper.floor_double(this.posX);
|
||||
final int j = MathHelper.floor_double(this.posY);
|
||||
final int k = MathHelper.floor_double(this.posZ);
|
||||
if (this.worldObj.getBlock(i, j, k) == null && Blocks.fire.canPlaceBlockAt(this.worldObj, i, j, k)) {
|
||||
this.worldObj.setBlock(i, j, k, Blocks.fire);
|
||||
onEntityUpdate();
|
||||
lightningState--;
|
||||
|
||||
if (lightningState < 0) {
|
||||
if (boltLivingTime == 0) {
|
||||
setDead();
|
||||
} else if (lightningState < -rand.nextInt(10)) {
|
||||
boltLivingTime--;
|
||||
lightningState = 1;
|
||||
boltVertex = rand.nextLong();
|
||||
|
||||
if (!worldObj.isRemote && worldObj.doChunksNearChunkExist(MathHelper.floor_double(posX), MathHelper.floor_double(posY), MathHelper.floor_double(posZ), 10)) {
|
||||
int i = MathHelper.floor_double(posX);
|
||||
int j = MathHelper.floor_double(posY);
|
||||
int k = MathHelper.floor_double(posZ);
|
||||
if (worldObj.getBlock(i, j, k) == null && Blocks.fire.canPlaceBlockAt(worldObj, i, j, k)) {
|
||||
worldObj.setBlock(i, j, k, Blocks.fire);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.lightningState >= 0) {
|
||||
if (this.worldObj.isRemote) {
|
||||
this.worldObj.lastLightningBolt = 2;
|
||||
}
|
||||
else {
|
||||
final double d0 = 3.0;
|
||||
final List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, AxisAlignedBB.getBoundingBox(this.posX - d0, this.posY - d0, this.posZ - d0, this.posX + d0, this.posY + 6.0 + d0, this.posZ + d0));
|
||||
for (int l = 0; l < list.size(); ++l) {
|
||||
final Entity entity = (Entity) list.get(l);
|
||||
|
||||
if (lightningState >= 0) {
|
||||
if (worldObj.isRemote) {
|
||||
worldObj.lastLightningBolt = 2;
|
||||
} else {
|
||||
double offset = 3.0;
|
||||
List list = worldObj.getEntitiesWithinAABBExcludingEntity(this, AxisAlignedBB.getBoundingBox(posX - offset, posY - offset, posZ - offset, posX + offset, posY + 6.0 + offset, posZ + offset));
|
||||
for (Object aList : list) {
|
||||
Entity entity = (Entity) aList;
|
||||
entity.onStruckByLightning(this);
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,87 +1,84 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.extrabees.genetics.effect;
|
||||
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class FireworkCreator
|
||||
{
|
||||
public enum Shape
|
||||
{
|
||||
public class FireworkCreator {
|
||||
public enum Shape {
|
||||
Ball,
|
||||
LargeBall,
|
||||
Star,
|
||||
Creeper,
|
||||
Burst;
|
||||
Burst
|
||||
}
|
||||
|
||||
public static class Firework
|
||||
{
|
||||
boolean flicker;
|
||||
boolean trail;
|
||||
ArrayList<Integer> colors;
|
||||
byte shape;
|
||||
public static class Firework {
|
||||
protected boolean flicker;
|
||||
protected boolean trail;
|
||||
protected ArrayList<Integer> colors;
|
||||
protected byte shape;
|
||||
|
||||
public Firework() {
|
||||
this.flicker = false;
|
||||
this.trail = false;
|
||||
this.colors = new ArrayList<Integer>();
|
||||
this.shape = 0;
|
||||
flicker = false;
|
||||
trail = false;
|
||||
colors = new ArrayList<>();
|
||||
shape = 0;
|
||||
}
|
||||
|
||||
public void setFlicker() {
|
||||
this.flicker = true;
|
||||
flicker = true;
|
||||
}
|
||||
|
||||
public void setTrail() {
|
||||
this.trail = true;
|
||||
trail = true;
|
||||
}
|
||||
|
||||
public void setShape(final Shape shape) {
|
||||
public void setShape(Shape shape) {
|
||||
this.shape = (byte) shape.ordinal();
|
||||
}
|
||||
|
||||
public void addColor(final int color) {
|
||||
this.colors.add(color);
|
||||
public void addColor(int color) {
|
||||
colors.add(color);
|
||||
}
|
||||
|
||||
NBTTagCompound getNBT() {
|
||||
final NBTTagCompound nbt = new NBTTagCompound();
|
||||
if (this.flicker) {
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
if (flicker) {
|
||||
nbt.setBoolean("Flicker", true);
|
||||
}
|
||||
if (this.trail) {
|
||||
|
||||
if (trail) {
|
||||
nbt.setBoolean("Trail", true);
|
||||
}
|
||||
if (this.colors.size() == 0) {
|
||||
this.addColor(16777215);
|
||||
|
||||
if (colors.size() == 0) {
|
||||
addColor(0xffffff);
|
||||
}
|
||||
final int[] array = new int[this.colors.size()];
|
||||
for (int i = 0; i < this.colors.size(); ++i) {
|
||||
array[i] = this.colors.get(i);
|
||||
|
||||
int[] array = new int[colors.size()];
|
||||
for (int i = 0; i < colors.size(); ++i) {
|
||||
array[i] = colors.get(i);
|
||||
}
|
||||
|
||||
nbt.setIntArray("Colors", array);
|
||||
nbt.setByte("Type", this.shape);
|
||||
nbt.setByte("Type", shape);
|
||||
return nbt;
|
||||
}
|
||||
|
||||
public ItemStack getFirework() {
|
||||
final NBTTagCompound var15 = new NBTTagCompound();
|
||||
final NBTTagCompound var16 = new NBTTagCompound();
|
||||
final NBTTagList var17 = new NBTTagList();
|
||||
var17.appendTag(this.getNBT());
|
||||
var16.setTag("Explosions", var17);
|
||||
var16.setByte("Flight", (byte) 0);
|
||||
var15.setTag("Fireworks", var16);
|
||||
final ItemStack item = new ItemStack(Items.fireworks);
|
||||
item.setTagCompound(var15);
|
||||
NBTTagCompound fireworksNbt = new NBTTagCompound();
|
||||
NBTTagCompound fireworkNbt = new NBTTagCompound();
|
||||
NBTTagList explosions = new NBTTagList();
|
||||
explosions.appendTag(getNBT());
|
||||
fireworkNbt.setTag("Explosions", explosions);
|
||||
fireworkNbt.setByte("Flight", (byte) 0);
|
||||
fireworksNbt.setTag("Fireworks", fireworkNbt);
|
||||
ItemStack item = new ItemStack(Items.fireworks);
|
||||
item.setTagCompound(fireworksNbt);
|
||||
return item;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user