feat: a bunch of fixes

This commit is contained in:
LordMZTE 2022-10-22 00:23:46 +02:00
parent 1a4d250a47
commit af8619a7aa
Signed by: LordMZTE
GPG key ID: B64802DC33A64FF6
53 changed files with 1128 additions and 1022 deletions

View file

@ -61,6 +61,7 @@ import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper;
import cpw.mods.fml.common.registry.EntityRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
@ -113,20 +114,7 @@ public class AtomicScience {
serverSide = "atomicscience.CommonProxy")
public static CommonProxy proxy;
@Metadata("AtomicScience") public static ModMetadata metadata;
public static final String WEN_JIAN_NO_SLASH = "atomicscience/";
public static final String WEN_JIAN = "/atomicscience/";
public static final String DIR = "/mods/atomicscience/";
public static final String TEXTURE_WEN_JIAN = "/mods/atomicscience/textures/";
public static final String SHI_MIAN_WEN_JIAN =
"/mods/atomicscience/textures/gui/";
public static final String BLOCK_WEN_JIAN =
"/mods/atomicscience/textures/blocks/";
public static final String ITEM_WEN_JIAN =
"/mods/atomicscience/textures/items/";
public static final String MODEL_WEN_JIAN =
"/mods/atomicscience/textures/models/";
// private static final String YU_YAN_WEN_JIAN = "/mods/atomicscience/yuyan/";
private static final String[] YU_YAN = new String[] {"en_US"};
private static final String[] LANGUAGES = new String[] {"en_US"};
public static float WOLUN_MULTIPLIER_OUTPUT = 30.0F;
public static boolean ALLOW_LAYERED_TURBINES = true;
public static boolean ALLOW_TOXIC_WASTE = true;
@ -164,7 +152,7 @@ public class AtomicScience {
public static Block bUraniumOre;
public static Item itYellowcake;
public static Item itUranium;
public static ItemElectric itWenDuBiao;
public static ItemElectric itThermometer;
public static Item itHazmatHelmet;
public static Item itHazmatChestplate;
public static Item itHazmanLeggings;
@ -182,6 +170,8 @@ public class AtomicScience {
// FlagRegistry.registerFlag("ban_antimatter_power");
public static final Logger LOGGER = Logger.getLogger("AtomicScience");
public static SimpleNetworkWrapper channel;
@EventHandler
public void preInit(FMLPreInitializationEvent event) {
instance = this;
@ -252,7 +242,7 @@ public class AtomicScience {
itHazmatBoots = (new ItHazmatSuite(hazmatArmorMaterial,
proxy.getArmorIndex("hazmat"), 3))
.setUnlocalizedName("atomicscience:hazmatBoots");
itWenDuBiao = new ItThermometer(1);
itThermometer = new ItThermometer(1);
itCell = new ItCell("cellEmpty");
itCellUranium = new ItFissileFuel();
itCellDeuterium = new ItCell("cellDeuterium");
@ -260,7 +250,8 @@ public class AtomicScience {
itCellAntimatter = new ItAntimatterCell();
itCellWater = new ItCell("cellWater");
itCellBreederFuel = new ItBreederFuel();
itYellowcake = new ItRadioactive("yellowcake");
itYellowcake = new ItRadioactive("yellowcake")
.setTextureName("atomicscience:yellowcake");
itUranium = new ItUranium(0);
FLUID_URANIUM_HEXAFLOURIDE = getOrRegisterFluid("uranium_hexafluoride");
FLUID_STEAM = getOrRegisterFluid("steam");
@ -270,11 +261,29 @@ public class AtomicScience {
itBucketToxic = (new ItemBucket(bToxicWaste))
.setCreativeTab(TabAS.INSTANCE)
.setUnlocalizedName("atomicscience:bucketToxicWaste")
.setTextureName("atomicscience:bucketToxicWaste")
.setContainerItem(Items.bucket);
FluidContainerRegistry.registerFluidContainer(new FluidContainerData(
new FluidStack(FLUID_TOXIC_WASTE, 1000), new ItemStack(itBucketToxic),
new ItemStack(Items.bucket)));
NetworkRegistry.INSTANCE.registerGuiHandler(this, proxy);
GameRegistry.registerItem(itCell, "itCell");
GameRegistry.registerItem(itCellUranium, "itCellUranium");
GameRegistry.registerItem(itCellBreederFuel, "itCellBreederFuel");
GameRegistry.registerItem(itCellStrangeMatter, "itCellStrangeMatter");
GameRegistry.registerItem(itCellAntimatter, "itCellAntimatter");
GameRegistry.registerItem(itCellDeuterium, "itCellDeuterium");
GameRegistry.registerItem(itCellWater, "itCellWater");
GameRegistry.registerItem(itBucketToxic, "itBucketToxic");
GameRegistry.registerItem(itYellowcake, "itYellowcake");
GameRegistry.registerItem(itUranium, "itUranium");
GameRegistry.registerItem(itThermometer, "itThermometer");
GameRegistry.registerItem(itHazmatHelmet, "itHazmatHelmet");
GameRegistry.registerItem(itHazmatChestplate, "itHazmatChestplate");
GameRegistry.registerItem(itHazmanLeggings, "itHazmanLeggings");
GameRegistry.registerItem(itHazmatBoots, "itHazmatBoots");
GameRegistry.registerBlock(blockRadioactive, "blockRadioactive");
GameRegistry.registerBlock(bUraniumOre, "bUraniumOre");
GameRegistry.registerBlock(bCentrifuge, "bCentrifuge");
@ -358,6 +367,10 @@ public class AtomicScience {
GameRegistry.registerTileEntity(TFissionReactor.class, "ASFissionReactor");
GameRegistry.registerTileEntity(TReactorTap.class, "ASReactorTap");
proxy.preInit();
channel = NetworkRegistry.INSTANCE.newSimpleChannel("AtomicScience");
channel.registerMessage(PHAutoBuilder.class, PAutoBuilder.class, 0,
Side.SERVER);
}
@EventHandler
@ -372,9 +385,11 @@ public class AtomicScience {
metadata.authorList = Arrays.asList(new String[] {"Calclavia"});
metadata.credits = "Please visit the website.";
metadata.autogenerated = false;
LOGGER.fine(
"Loaded Languages: " +
TranslationHelper.loadLanguages("/mods/atomicscience/yuyan/", YU_YAN));
LOGGER.fine("Loaded Languages: " +
TranslationHelper.loadLanguages("/assets/atomicscience/lang/",
LANGUAGES));
proxy.init();
}
@EventHandler
@ -461,7 +476,7 @@ public class AtomicScience {
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(itCellWater),
itCell, Items.water_bucket));
GameRegistry.addRecipe(new ShapedOreRecipe(
ElectricItemHelper.getUncharged(new ItemStack(itWenDuBiao)),
ElectricItemHelper.getUncharged(new ItemStack(itThermometer)),
new Object[] {"SSS", "GCG", "GSG", Character.valueOf('S'), "ingotSteel",
Character.valueOf('G'), Blocks.glass,
Character.valueOf('C'), "calclavia:CIRCUIT_T1"}));
@ -469,7 +484,7 @@ public class AtomicScience {
bThermometer, new Object[] {"SSS", "SWS", "SSS", Character.valueOf('S'),
"ingotSteel", Character.valueOf('W'),
ElectricItemHelper.getUncharged(
new ItemStack(itWenDuBiao))}));
new ItemStack(itThermometer))}));
GameRegistry.addRecipe(new ShapedOreRecipe(
bControlRod, new Object[] {"I", "I", "I", Character.valueOf('I'),
Items.iron_ingot}));
@ -518,7 +533,6 @@ public class AtomicScience {
EMatter.class, "ASParticle", EntityRegistry.findGlobalUniqueEntityId());
EntityRegistry.registerModEntity(EMatter.class, "ASParticle", 49, this, 80,
3, true);
proxy.init();
AtomicScience.CONFIGURATION.load();
if (Loader.isModLoaded("IC2") &&
AtomicScience.CONFIGURATION

View file

@ -9,40 +9,41 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
public class BAtomicAssembler extends BBase {
public BAtomicAssembler() {
super("atomicAssembler");
}
public BAtomicAssembler() {
super("atomicAssembler");
}
@Override
public boolean onMachineActivated(World par1World, int x, int y, int z,
EntityPlayer par5EntityPlayer, int side,
float hitX, float hitY, float hitZ) {
par1World.getBlockMetadata(x, y, z);
if (!par1World.isRemote) {
par5EntityPlayer.openGui(AtomicScience.instance,
CommonProxy.GuiType.ATOMIC_ASSEMBLER.ordinal(),
par1World, x, y, z);
}
return true;
}
@Override
public boolean onMachineActivated(World par1World, int x, int y, int z, EntityPlayer par5EntityPlayer, int side, float hitX, float hitY, float hitZ) {
par1World.getBlockMetadata(x, y, z);
if(!par1World.isRemote) {
par5EntityPlayer.openGui(AtomicScience.instance, CommonProxy.GuiType.GOU_CHENG.ordinal(), par1World, x, y, z);
return true;
} else {
return true;
}
}
@Override
public TileEntity createNewTileEntity(World var1, int meta) {
return new TAtomicAssembler();
}
@Override
public TileEntity createNewTileEntity(World var1, int meta) {
return new TAtomicAssembler();
}
@Override
public boolean renderAsNormalBlock() {
return false;
}
@Override
public boolean renderAsNormalBlock() {
return false;
}
@Override
public boolean isOpaqueCube() {
return false;
}
@Override
public boolean isOpaqueCube() {
return false;
}
@Override
@SideOnly(Side.CLIENT)
public int getRenderType() {
return RH.BLOCK_RENDER_ID;
}
@Override
@SideOnly(Side.CLIENT)
public int getRenderType() {
return RH.BLOCK_RENDER_ID;
}
}

View file

@ -6,10 +6,9 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
public class BAutoBuilder extends BBase {
public static final int BAN_JING = 30;
public BAutoBuilder() {
super("instantBuilder");
this.textureName = "atomicscience:instantBuilder";
}
@Override

View file

@ -23,7 +23,7 @@ import atomicscience.shimian.GAccelerator;
import atomicscience.shimian.GAtomicAssembler;
import atomicscience.shimian.GAutoBuilder;
import atomicscience.shimian.GCentrifuge;
import atomicscience.shimian.GChemicalReactor;
import atomicscience.shimian.GChemicalExtractor;
import atomicscience.shimian.GFissionReactor;
import atomicscience.shimian.GNuclearBoiler;
import cpw.mods.fml.client.registry.ClientRegistry;
@ -42,6 +42,7 @@ public class ClientProxy extends CommonProxy {
return RenderingRegistry.addNewArmourRendererPrefix(armor);
}
@Override
public void init() {
super.init();
ClientRegistry.bindTileEntitySpecialRenderer(TCentrifuge.class,
@ -64,6 +65,7 @@ public class ClientProxy extends CommonProxy {
new RMatter());
}
@Override
public Object getClientGuiElement(int ID, EntityPlayer player, World world,
int x, int y, int z) {
TileEntity tileEntity = world.getTileEntity(x, y, z);
@ -77,7 +79,7 @@ public class ClientProxy extends CommonProxy {
}
if (tileEntity instanceof TChemicalExtractor) {
return new GChemicalReactor(player.inventory,
return new GChemicalExtractor(player.inventory,
(TChemicalExtractor)tileEntity);
}

View file

@ -18,57 +18,59 @@ import net.minecraft.world.World;
public class CommonProxy implements IGuiHandler {
public void preInit() {}
public void init() {}
public int getArmorIndex(String armor) { return 0; }
public Object getClientGuiElement(int ID, EntityPlayer player, World world,
int x, int y, int z) {
return null;
}
public Object getServerGuiElement(int ID, EntityPlayer player, World world,
int x, int y, int z) {
TileEntity tileEntity = world.getTileEntity(x, y, z);
if (tileEntity != null && ID < CommonProxy.GuiType.values().length &&
ID >= 0) {
if (tileEntity instanceof TCentrifuge) {
return new CCentrifuge(player.inventory, (TCentrifuge)tileEntity);
}
if (tileEntity instanceof TChemicalExtractor) {
return new CChemicalExtractor(player.inventory,
(TChemicalExtractor)tileEntity);
}
if (tileEntity instanceof TAccelerator) {
return new CAccelerator(player.inventory, (TAccelerator)tileEntity);
}
if (tileEntity instanceof TAtomicAssembler) {
return new CAssembler(player.inventory, (TAtomicAssembler)tileEntity);
}
if (tileEntity instanceof TNuclearBoiler) {
return new CNuclearBoiler(player.inventory, (TNuclearBoiler)tileEntity);
}
if (tileEntity instanceof TFissionReactor) {
return new CFissionReactor(player, (TFissionReactor)tileEntity);
}
public void preInit() {
}
return null;
}
public void init() {
}
public static enum GuiType {
public int getArmorIndex(String armor) {
return 0;
}
CENTRIFUGE,
DAO_CHOU_QI,
JIA_SU_QI,
GOU_CHENG,
HE_QI;
}
public Object getClientGuiElement(int ID, EntityPlayer player, World world,
int x, int y, int z) {
return null;
}
public Object getServerGuiElement(int ID, EntityPlayer player, World world,
int x, int y, int z) {
TileEntity tileEntity = world.getTileEntity(x, y, z);
if (tileEntity != null && ID < CommonProxy.GuiType.values().length) {
if (tileEntity instanceof TCentrifuge) {
return new CCentrifuge(player.inventory, (TCentrifuge) tileEntity);
}
if (tileEntity instanceof TChemicalExtractor) {
return new CChemicalExtractor(player.inventory,
(TChemicalExtractor) tileEntity);
}
if (tileEntity instanceof TAccelerator) {
return new CAccelerator(player.inventory, (TAccelerator) tileEntity);
}
if (tileEntity instanceof TAtomicAssembler) {
return new CAssembler(player.inventory, (TAtomicAssembler) tileEntity);
}
if (tileEntity instanceof TNuclearBoiler) {
return new CNuclearBoiler(player.inventory, (TNuclearBoiler) tileEntity);
}
if (tileEntity instanceof TFissionReactor) {
return new CFissionReactor(player, (TFissionReactor) tileEntity);
}
}
return null;
}
public static enum GuiType {
CENTRIFUGE,
CHEMICAL_EXTRACTOR,
ACCELERATOR,
ATOMIC_ASSEMBLER,
HE_QI;
}
}

View file

@ -12,37 +12,47 @@ import net.minecraft.nbt.NBTTagCompound;
import universalelectricity.core.vector.Vector3;
public class PAutoBuilder implements IMessage {
public Vector3 pos;
public TAutoBuilder.AutoBuilderType type;
public int radius;
public Vector3 pos;
public TAutoBuilder.AutoBuilderType type;
public int radius;
@Override
public void fromBytes(ByteBuf buf) {
try {
NBTTagCompound nbt = CompressedStreamTools.read(
new DataInputStream(new ByteBufInputStream(buf)));
this.pos = Vector3.readFromNBT(nbt.getCompoundTag("pos"));
this.type = TAutoBuilder.AutoBuilderType.get(nbt.getInteger("type"));
this.radius = nbt.getInteger("radius");
} catch (IOException e) {
e.printStackTrace();
public PAutoBuilder(Vector3 pos, TAutoBuilder.AutoBuilderType type,
int radius) {
this.pos = pos;
this.type = type;
this.radius = radius;
}
}
@Override
public void toBytes(ByteBuf buf) {
NBTTagCompound nbt = new NBTTagCompound();
nbt.setTag("pos", this.pos.writeToNBT(new NBTTagCompound()));
nbt.setInteger("type", this.type.ordinal());
nbt.setInteger("radius", this.radius);
try {
CompressedStreamTools.write(
nbt, new DataOutputStream(new ByteBufOutputStream(buf)));
} catch (IOException e) {
e.printStackTrace();
public PAutoBuilder() {
}
@Override
public void fromBytes(ByteBuf buf) {
try {
NBTTagCompound nbt = CompressedStreamTools.read(
new DataInputStream(new ByteBufInputStream(buf)));
this.pos = Vector3.readFromNBT(nbt.getCompoundTag("pos"));
this.type = TAutoBuilder.AutoBuilderType.get(nbt.getInteger("type"));
this.radius = nbt.getInteger("radius");
} catch (IOException e) {
e.printStackTrace();
}
}
@Override
public void toBytes(ByteBuf buf) {
NBTTagCompound nbt = new NBTTagCompound();
nbt.setTag("pos", this.pos.writeToNBT(new NBTTagCompound()));
nbt.setInteger("type", this.type.ordinal());
nbt.setInteger("radius", this.radius);
try {
CompressedStreamTools.write(
nbt, new DataOutputStream(new ByteBufOutputStream(buf)));
} catch (IOException e) {
e.printStackTrace();
}
}
}
}

View file

@ -21,121 +21,120 @@ import universalelectricity.core.vector.Vector3;
public class BlockRadioactive extends Block {
public static int RECOMMENDED_ID = 3768;
public boolean canSpread;
public float radius;
public int amplifier;
public boolean canWalkPoison;
public boolean isRandomlyRadioactive;
private IIcon iconTop;
private IIcon iconBottom;
public static int RECOMMENDED_ID = 3768;
public boolean canSpread;
public float radius;
public int amplifier;
public boolean canWalkPoison;
public boolean isRandomlyRadioactive;
private IIcon iconTop;
private IIcon iconBottom;
public BlockRadioactive(Material material) {
super(material);
this.canSpread = true;
this.radius = 5.0F;
this.amplifier = 2;
this.canWalkPoison = true;
this.isRandomlyRadioactive = true;
this.setTickRandomly(true);
this.setHardness(0.2F);
this.setLightLevel(0.1F);
public BlockRadioactive(Material material) {
super(material);
this.canSpread = true;
this.radius = 5.0F;
this.amplifier = 2;
this.canWalkPoison = true;
this.isRandomlyRadioactive = true;
this.setTickRandomly(true);
this.setHardness(0.2F);
this.setLightLevel(0.1F);
}
public BlockRadioactive() { this(Material.rock); }
@Override
public IIcon getIcon(int side, int metadata) {
return side == 1 ? this.iconTop
: (side == 0 ? this.iconBottom : this.blockIcon);
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconRegister) {
super.registerBlockIcons(iconRegister);
this.blockIcon = iconRegister.registerIcon(
this.getUnlocalizedName().replace("tile.", ""));
this.iconTop = iconRegister.registerIcon(
this.getUnlocalizedName().replace("tile.", "") + "_top");
this.iconBottom = iconRegister.registerIcon(
this.getUnlocalizedName().replace("tile.", "") + "_bottom");
}
@Override
public void onBlockClicked(World world, int x, int y, int z,
EntityPlayer par5EntityPlayer) {
if ((double)world.rand.nextFloat() > 0.8D) {
this.updateTick(world, x, y, z, world.rand);
}
}
public BlockRadioactive() {
this(Material.rock);
}
@Override
public void updateTick(World world, int x, int y, int z, Random rand) {
if (!world.isRemote) {
if (this.isRandomlyRadioactive) {
AxisAlignedBB i = AxisAlignedBB.getBoundingBox(
(double)((float)x - this.radius), (double)((float)y - this.radius),
(double)((float)z - this.radius), (double)((float)x + this.radius),
(double)((float)y + this.radius), (double)((float)z + this.radius));
List<EntityLiving> newX =
world.getEntitiesWithinAABB(EntityLiving.class, i);
@Override
public IIcon getIcon(int side, int metadata) {
return side == 1 ? this.iconTop
: (side == 0 ? this.iconBottom : this.blockIcon);
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconRegister) {
super.registerBlockIcons(iconRegister);
this.iconTop = iconRegister.registerIcon(
this.getUnlocalizedName().replace("tile.", "") + "_top");
this.iconBottom = iconRegister.registerIcon(
this.getUnlocalizedName().replace("tile.", "") + "_bottom");
}
@Override
public void onBlockClicked(World world, int x, int y, int z,
EntityPlayer par5EntityPlayer) {
if ((double) world.rand.nextFloat() > 0.8D) {
this.updateTick(world, x, y, z, world.rand);
for (EntityLiving newZ : newX) {
PoisonRadiation.INSTANCE.poisonEntity(
new Vector3((double)x, (double)y, (double)z), newZ,
this.amplifier);
}
}
}
@Override
public void updateTick(World world, int x, int y, int z, Random rand) {
if (!world.isRemote) {
if (this.isRandomlyRadioactive) {
AxisAlignedBB i = AxisAlignedBB.getBoundingBox(
(double) ((float) x - this.radius), (double) ((float) y - this.radius),
(double) ((float) z - this.radius), (double) ((float) x + this.radius),
(double) ((float) y + this.radius), (double) ((float) z + this.radius));
List<EntityLiving> newX = world.getEntitiesWithinAABB(EntityLiving.class, i);
for (EntityLiving newZ : newX) {
PoisonRadiation.INSTANCE.poisonEntity(
new Vector3((double) x, (double) y, (double) z), newZ,
this.amplifier);
}
}
if (this.canSpread) {
for (int var11 = 0; var11 < 4; ++var11) {
int xOffset = x + rand.nextInt(3) - 1;
int yOffset = y + rand.nextInt(5) - 3;
int zOffset = z + rand.nextInt(3) - 1;
Block block = world.getBlock(xOffset, yOffset, zOffset);
if ((double) rand.nextFloat() > 0.4D &&
(block == Blocks.farmland || block == Blocks.grass)) {
world.setBlock(xOffset, yOffset, zOffset, this);
}
}
if ((double) rand.nextFloat() > 0.85D) {
world.setBlock(x, y, z, Blocks.mycelium);
}
}
if (this.canSpread) {
for (int var11 = 0; var11 < 4; ++var11) {
int xOffset = x + rand.nextInt(3) - 1;
int yOffset = y + rand.nextInt(5) - 3;
int zOffset = z + rand.nextInt(3) - 1;
Block block = world.getBlock(xOffset, yOffset, zOffset);
if ((double)rand.nextFloat() > 0.4D &&
(block == Blocks.farmland || block == Blocks.grass)) {
world.setBlock(xOffset, yOffset, zOffset, this);
}
}
}
public void func_71891_b(World par1World, int x, int y, int z,
Entity par5Entity) {
if (par5Entity instanceof EntityLiving && this.canWalkPoison) {
PoisonRadiation.INSTANCE.poisonEntity(
new Vector3((double) x, (double) y, (double) z),
(EntityLiving) par5Entity);
if ((double)rand.nextFloat() > 0.85D) {
world.setBlock(x, y, z, Blocks.mycelium);
}
}
}
}
public int func_71925_a(Random par1Random) {
return 0;
public void func_71891_b(World par1World, int x, int y, int z,
Entity par5Entity) {
if (par5Entity instanceof EntityLiving && this.canWalkPoison) {
PoisonRadiation.INSTANCE.poisonEntity(
new Vector3((double)x, (double)y, (double)z),
(EntityLiving)par5Entity);
}
}
@SideOnly(Side.CLIENT)
public void func_71862_a(World world, int x, int y, int z,
Random par5Random) {
if (Minecraft.getMinecraft().gameSettings.particleSetting == 0) {
byte radius = 3;
public int func_71925_a(Random par1Random) { return 0; }
for (int i = 0; i < 2; ++i) {
Vector3 diDian = new Vector3((double) x, (double) y, (double) z);
diDian.x += Math.random() * (double) radius - (double) (radius / 2);
diDian.y += Math.random() * (double) radius - (double) (radius / 2);
diDian.z += Math.random() * (double) radius - (double) (radius / 2);
EntitySmokeFX fx = new EntitySmokeFX(
world, diDian.x, diDian.y, diDian.z, (Math.random() - 0.5D) / 2.0D,
(Math.random() - 0.5D) / 2.0D, (Math.random() - 0.5D) / 2.0D);
fx.setRBGColorF(0.2F, 0.8F, 0.0F);
Minecraft.getMinecraft().effectRenderer.addEffect(fx);
}
}
@SideOnly(Side.CLIENT)
public void func_71862_a(World world, int x, int y, int z,
Random par5Random) {
if (Minecraft.getMinecraft().gameSettings.particleSetting == 0) {
byte radius = 3;
for (int i = 0; i < 2; ++i) {
Vector3 diDian = new Vector3((double)x, (double)y, (double)z);
diDian.x += Math.random() * (double)radius - (double)(radius / 2);
diDian.y += Math.random() * (double)radius - (double)(radius / 2);
diDian.z += Math.random() * (double)radius - (double)(radius / 2);
EntitySmokeFX fx = new EntitySmokeFX(
world, diDian.x, diDian.y, diDian.z, (Math.random() - 0.5D) / 2.0D,
(Math.random() - 0.5D) / 2.0D, (Math.random() - 0.5D) / 2.0D);
fx.setRBGColorF(0.2F, 0.8F, 0.0F);
Minecraft.getMinecraft().effectRenderer.addEffect(fx);
}
}
}
}

View file

@ -1,9 +1,10 @@
package atomicscience.fanwusu;
import atomicscience.CommonProxy;
import atomicscience.AtomicScience;
import atomicscience.CommonProxy;
import atomicscience.api.IElectromagnet;
import atomicscience.jiqi.BBaseRotatable;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
@ -11,24 +12,35 @@ import universalelectricity.core.UniversalElectricity;
public class BAccelerator extends BBaseRotatable implements IElectromagnet {
public BAccelerator() {
super("accelerator", UniversalElectricity.machine);
}
public BAccelerator() { super("accelerator", UniversalElectricity.machine); }
public boolean onMachineActivated(World par1World, int x, int y, int z, EntityPlayer par5EntityPlayer, int side, float hitX, float hitY, float hitZ) {
par1World.getBlockMetadata(x, y, z);
if(!par1World.isRemote) {
par5EntityPlayer.openGui(AtomicScience.instance, CommonProxy.GuiType.JIA_SU_QI.ordinal(), par1World, x, y, z);
}
@Override
public boolean onMachineActivated(World par1World, int x, int y, int z,
EntityPlayer par5EntityPlayer, int side,
float hitX, float hitY, float hitZ) {
par1World.getBlockMetadata(x, y, z);
if (!par1World.isRemote) {
par5EntityPlayer.openGui(AtomicScience.instance,
CommonProxy.GuiType.ACCELERATOR.ordinal(),
par1World, x, y, z);
}
return true;
}
return true;
}
public TileEntity createNewTileEntity(World world, int meta) {
return new TAccelerator();
}
@Override
public TileEntity createNewTileEntity(World world, int meta) {
return new TAccelerator();
}
public boolean isRunning(World world, int x, int y, int z) {
return true;
}
@Override
public void registerBlockIcons(IIconRegister iconRegister) {
this.blockIcon = iconRegister.registerIcon("atomicscience:accelerator");
}
@Override
public boolean isRunning(World world, int x, int y, int z) {
// TODO: WTF
return true;
}
}

View file

@ -1,17 +1,17 @@
package atomicscience.fanwusu;
import atomicscience.fanwusu.TFulminationGenerator;
import atomicscience.jiqi.BBase;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
public class BFulminationGenerator extends BBase {
public BFulminationGenerator() {
super("fulmination");
this.setHardness(50.0F);
this.textureName = "atomicscience:fulmination";
}
@Override
public TileEntity createNewTileEntity(World world, int meta) {
return new TFulminationGenerator();
}

View file

@ -1,6 +1,7 @@
package atomicscience.fanwusu;
import atomicscience.AtomicScience;
import atomicscience.SoundManager;
import atomicscience.api.IElectromagnet;
import atomicscience.api.poison.PoisonRadiation;
import cpw.mods.fml.common.registry.IEntityAdditionalSpawnData;
@ -80,7 +81,7 @@ public class EMatter extends Entity implements IEntityAdditionalSpawnData {
public void onUpdate() {
if (super.ticksExisted % 10 == 0) {
super.worldObj.playSoundAtEntity(
this, "atomicscience.accelerator", 1.5F,
this, SoundManager.ACCELERATOR, 1.5F,
(float)(0.6000000238418579D + 0.4D * (this.getSuDu() / 1.0D)));
}

View file

@ -1,6 +1,7 @@
package atomicscience.fanwusu;
import atomicscience.AtomicScience;
import atomicscience.SoundManager;
import atomicscience.api.poison.PoisonRadiation;
import atomicscience.wujian.ItCell;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
@ -77,7 +78,7 @@ public class ItAntimatterCell extends ItCell {
if (itemStack != null && itemStack.getItem() == this) {
event.entityItem.worldObj.playSoundEffect(
event.entityItem.posX, event.entityItem.posY, event.entityItem.posZ,
"atomicscience.antimatter", 3.0F,
SoundManager.ANTIMATTER, 3.0F,
1.0F - event.entityItem.worldObj.rand.nextFloat() * 0.3F);
if (!event.entityItem.worldObj.isRemote
// &&

View file

@ -1,6 +1,7 @@
package atomicscience.fanwusu;
import atomicscience.AtomicScience;
import atomicscience.SoundManager;
import atomicscience.jiqi.TInventory;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
@ -108,7 +109,7 @@ public class TAccelerator
} else if (this.suDu > 1.0F) {
this.worldObj.playSoundEffect(
(double)this.xCoord, (double)this.yCoord, (double)this.zCoord,
"atomicscience.antimatter", 2.0F,
SoundManager.ANTIMATTER, 2.0F,
1.0F - this.worldObj.rand.nextFloat() * 0.3F);
this.antimatter += 5 + this.worldObj.rand.nextInt(5);
this.yongDianLiang = 0.0D;

View file

@ -1,24 +1,13 @@
package atomicscience.fenlie;
import atomicscience.jiqi.BBase;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.init.Blocks;
public class BControlRod extends BBase {
public BControlRod() {
super("controlRod", Material.iron);
this.setBlockBounds(0.3F, 0.0F, 0.3F, 0.7F, 1.0F, 0.7F);
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconRegister) {
this.blockIcon = iconRegister.registerIcon(
Blocks.iron_block.getUnlocalizedName().replace("tile.", ""));
this.textureName = "minecraft:iron_block";
}
@Override

View file

@ -2,7 +2,6 @@ package atomicscience.fenlie;
import atomicscience.AtomicScience;
import atomicscience.api.IFissileMaterial;
import atomicscience.fenlie.TFissionReactor;
import atomicscience.jiqi.BBase;
import atomicscience.render.RH;
import cpw.mods.fml.relauncher.Side;
@ -17,82 +16,86 @@ import net.minecraft.world.World;
public class BFissionReactor extends BBase {
public BFissionReactor() { super("fissionReactor"); }
@Override
public void onBlockAdded(World par1World, int x, int y, int z) {
super.onBlockAdded(par1World, x, y, z);
TFissionReactor tileEntity =
(TFissionReactor)par1World.getTileEntity(x, y, z);
tileEntity.updatePositionStatus();
}
@Override
public void onNeighborBlockChange(World par1World, int x, int y, int z,
Block block) {
TFissionReactor tileEntity =
(TFissionReactor)par1World.getTileEntity(x, y, z);
tileEntity.updatePositionStatus();
}
@Override
public boolean onMachineActivated(World world, int x, int y, int z,
EntityPlayer entityPlayer, int side,
float hitX, float hitY, float hitZ) {
if (!world.isRemote) {
TFissionReactor tileEntity =
(TFissionReactor)world.getTileEntity(x, y, z);
tileEntity = tileEntity.zhaoZuiDi();
if (!entityPlayer.isSneaking()) {
if (entityPlayer.inventory.getCurrentItem() != null &&
entityPlayer.inventory.getCurrentItem().getItem() ==
AtomicScience.itWenDuBiao) {
return false;
}
if (tileEntity.getStackInSlot(0) != null) {
EntityItem itemStack1 =
new EntityItem(world, entityPlayer.posX, entityPlayer.posY,
entityPlayer.posZ, tileEntity.getStackInSlot(0));
Random random = new Random();
float var13 = 0.05F;
itemStack1.motionX = (double)((float)random.nextGaussian() * var13);
itemStack1.motionY =
(double)((float)random.nextGaussian() * var13 + 0.2F);
itemStack1.motionZ = (double)((float)random.nextGaussian() * var13);
itemStack1.delayBeforeCanPickup = 0;
world.spawnEntityInWorld(itemStack1);
tileEntity.setInventorySlotContents(0, (ItemStack)null);
return true;
}
if (entityPlayer.inventory.getCurrentItem() != null &&
entityPlayer.inventory.getCurrentItem().getItem() instanceof
IFissileMaterial) {
ItemStack itemStack = entityPlayer.inventory.getCurrentItem().copy();
itemStack.stackSize = 1;
tileEntity.setInventorySlotContents(0, itemStack);
entityPlayer.inventory.decrStackSize(
entityPlayer.inventory.currentItem, 1);
return true;
}
}
entityPlayer.openGui(AtomicScience.instance, 0, world, tileEntity.xCoord,
tileEntity.yCoord, tileEntity.zCoord);
public BFissionReactor() {
super("fissionReactor");
}
return true;
}
@Override
public void onBlockAdded(World par1World, int x, int y, int z) {
super.onBlockAdded(par1World, x, y, z);
TFissionReactor tileEntity = (TFissionReactor) par1World.getTileEntity(x, y, z);
tileEntity.updatePositionStatus();
}
@SideOnly(Side.CLIENT)
public int getRenderType() {
return RH.BLOCK_RENDER_ID;
}
@Override
public void onNeighborBlockChange(World par1World, int x, int y, int z,
Block block) {
TFissionReactor tileEntity = (TFissionReactor) par1World.getTileEntity(x, y, z);
tileEntity.updatePositionStatus();
}
public TileEntity createNewTileEntity(World var1) { return new TFissionReactor(); }
@Override
public boolean onMachineActivated(World world, int x, int y, int z,
EntityPlayer entityPlayer, int side,
float hitX, float hitY, float hitZ) {
if (!world.isRemote) {
TFissionReactor tileEntity = (TFissionReactor) world.getTileEntity(x, y, z);
tileEntity = tileEntity.zhaoZuiDi();
if (!entityPlayer.isSneaking()) {
if (entityPlayer.inventory.getCurrentItem() != null &&
entityPlayer.inventory.getCurrentItem().getItem() == AtomicScience.itThermometer) {
return false;
}
public boolean renderAsNormalBlock() { return false; }
if (tileEntity.getStackInSlot(0) != null) {
EntityItem itemStack1 = new EntityItem(world, entityPlayer.posX, entityPlayer.posY,
entityPlayer.posZ, tileEntity.getStackInSlot(0));
Random random = new Random();
float var13 = 0.05F;
itemStack1.motionX = (double) ((float) random.nextGaussian() * var13);
itemStack1.motionY = (double) ((float) random.nextGaussian() * var13 + 0.2F);
itemStack1.motionZ = (double) ((float) random.nextGaussian() * var13);
itemStack1.delayBeforeCanPickup = 0;
world.spawnEntityInWorld(itemStack1);
tileEntity.setInventorySlotContents(0, (ItemStack) null);
return true;
}
public boolean isOpaqueCube() { return false; }
if (entityPlayer.inventory.getCurrentItem() != null &&
entityPlayer.inventory.getCurrentItem().getItem() instanceof IFissileMaterial) {
ItemStack itemStack = entityPlayer.inventory.getCurrentItem().copy();
itemStack.stackSize = 1;
tileEntity.setInventorySlotContents(0, itemStack);
entityPlayer.inventory.decrStackSize(
entityPlayer.inventory.currentItem, 1);
return true;
}
}
entityPlayer.openGui(AtomicScience.instance, 0, world, tileEntity.xCoord,
tileEntity.yCoord, tileEntity.zCoord);
}
return true;
}
@SideOnly(Side.CLIENT)
public int getRenderType() {
return RH.BLOCK_RENDER_ID;
}
@Override
public TileEntity createNewTileEntity(World var1, int meta) {
return new TFissionReactor();
}
@Override
public boolean renderAsNormalBlock() {
return false;
}
@Override
public boolean isOpaqueCube() {
return false;
}
}

View file

@ -1,11 +1,9 @@
package atomicscience.fenlie;
import atomicscience.fenlie.TReactorTap;
import atomicscience.jiqi.BBaseRotatable;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
@ -50,7 +48,12 @@ public class BReactorTap extends BBaseRotatable {
super.registerBlockIcons(iconRegister);
this.frontIcon = iconRegister.registerIcon(
this.getUnlocalizedName().replace("tile.", "") + "_front");
this.blockIcon = iconRegister.registerIcon(
this.getUnlocalizedName().replace("tile.", ""));
}
public TileEntity createNewTileEntity(World world, int meta) { return new TReactorTap(); }
@Override
public TileEntity createNewTileEntity(World world, int meta) {
return new TReactorTap();
}
}

View file

@ -1,8 +1,8 @@
package atomicscience.fenlie;
import atomicscience.SoundManager;
import atomicscience.jiqi.BBase;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
@ -10,66 +10,73 @@ import net.minecraftforge.common.util.ForgeDirection;
import universalelectricity.core.vector.Vector3;
public class BSiren extends BBase {
public BSiren() {
super("siren");
this.textureName = "atomicscience:siren";
}
public BSiren() {
super("siren");
}
@Override
public void onBlockAdded(World par1World, int x, int y, int z) {
par1World.scheduleBlockUpdate(x, y, z, this, 1);
}
@Override
public void onBlockAdded(World par1World, int x, int y, int z) {
par1World.scheduleBlockUpdate(x, y, z, this, 1);
}
@Override
public void onNeighborBlockChange(World par1World, int x, int y, int z,
Block block) {
par1World.scheduleBlockUpdate(x, y, z, this, 1);
}
@Override
public void onNeighborBlockChange(World par1World, int x, int y, int z, Block block) {
par1World.scheduleBlockUpdate(x, y, z, this, 1);
}
@Override
public void updateTick(World worldObj, int x, int y, int z,
Random par5Random) {
int metadata = worldObj.getBlockMetadata(x, y, z);
if (worldObj.getBlockPowerInput(x, y, z) > 0) {
float volume = 0.5F;
@Override
public void updateTick(World worldObj, int x, int y, int z, Random par5Random) {
int metadata = worldObj.getBlockMetadata(x, y, z);
if(worldObj.getBlockPowerInput(x, y, z) > 0) {
float volume = 0.5F;
for(int i = 0; i < 6; ++i) {
Vector3 pos = new Vector3((double)x, (double)y, (double)z);
pos.modifyPositionFromSide(ForgeDirection.getOrientation(i));
Block block = pos.getBlock(worldObj);
if(block == this) {
volume *= 1.5F;
for (int i = 0; i < 6; ++i) {
Vector3 pos = new Vector3((double) x, (double) y, (double) z);
pos.modifyPositionFromSide(ForgeDirection.getOrientation(i));
Block block = pos.getBlock(worldObj);
if (block == this) {
volume *= 1.5F;
}
}
}
worldObj.playSoundEffect((double)x, (double)y, (double)z, "atomicscience.alarm", volume, 1.0F - 0.18F * ((float)metadata / 15.0F));
worldObj.scheduleBlockUpdate(x, y, z, this, 30);
}
worldObj.playSoundEffect((double) x, (double) y, (double) z,
SoundManager.ALARM, volume,
1.0F - 0.18F * ((float) metadata / 15.0F));
worldObj.scheduleBlockUpdate(x, y, z, this, 30);
}
}
}
@Override
public boolean onUseWrench(World par1World, int x, int y, int z,
EntityPlayer par5EntityPlayer, int side,
float hitX, float hitY, float hitZ) {
int metadata = par1World.getBlockMetadata(x, y, z) + 1;
if (metadata < 0) {
metadata = 15;
}
@Override
public boolean onUseWrench(World par1World, int x, int y, int z, EntityPlayer par5EntityPlayer, int side, float hitX, float hitY, float hitZ) {
int metadata = par1World.getBlockMetadata(x, y, z) + 1;
if(metadata < 0) {
metadata = 15;
}
par1World.setBlockMetadataWithNotify(x, y, z, metadata, 2);
return true;
}
par1World.setBlockMetadataWithNotify(x, y, z, metadata, 2);
return true;
}
@Override
public boolean onSneakUseWrench(World par1World, int x, int y, int z,
EntityPlayer par5EntityPlayer, int side,
float hitX, float hitY, float hitZ) {
int metadata = par1World.getBlockMetadata(x, y, z) - 1;
if (metadata > 15) {
metadata = 0;
}
@Override
public boolean onSneakUseWrench(World par1World, int x, int y, int z, EntityPlayer par5EntityPlayer, int side, float hitX, float hitY, float hitZ) {
int metadata = par1World.getBlockMetadata(x, y, z) - 1;
if(metadata > 15) {
metadata = 0;
}
par1World.setBlockMetadataWithNotify(x, y, z, metadata, 2);
return true;
}
par1World.setBlockMetadataWithNotify(x, y, z, metadata, 2);
return true;
}
@Override
public int tickRate(World world) {
return 20;
}
@Override
public int tickRate(World world) {
return 20;
}
}

View file

@ -9,6 +9,7 @@ import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
@ -40,6 +41,11 @@ public class BUraniumOre extends BlockRadioactive {
return this.blockIcon;
}
@Override
public void registerBlockIcons(IIconRegister iconRegister) {
this.blockIcon = iconRegister.registerIcon("atomicscience:oreUranium");
}
@Override
public int quantityDropped(Random rand) {
return 1;

View file

@ -11,8 +11,6 @@ import universalelectricity.core.item.IItemElectric;
import universalelectricity.prefab.SlotSpecific;
public class CCentrifuge extends Container {
//private static final int slotCount = 4;
private TCentrifuge tileEntity;

View file

@ -4,8 +4,6 @@ import atomicscience.TabAS;
import atomicscience.wujian.ItCell;
public class ItStrangeMatter extends ItCell {
public static final int YONG_LIANG = 64;
public ItStrangeMatter() {
super("strangeMatter");
this.setMaxStackSize(1);

View file

@ -1,17 +1,20 @@
package atomicscience.fenlie;
import java.util.List;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
public class ItUranium extends ItRadioactive {
public ItUranium(int icon) {
super("uranium");
this.setHasSubtypes(true);
this.setMaxDamage(0);
this.setTextureName("atomicscience:uranium");
}
@Override
@ -21,7 +24,6 @@ public class ItUranium extends ItRadioactive {
} else {
list.add("Enriched Uranium");
}
}
@Override

View file

@ -23,214 +23,214 @@ import universalelectricity.core.vector.VectorHelper;
import universalelectricity.prefab.implement.IRotatable;
public class TCentrifuge
extends TInventory implements ISidedInventory, IFluidHandler, IRotatable {
extends TInventory implements ISidedInventory, IFluidHandler, IRotatable {
public static final int SHI_JIAN = 2400;
public static final float DIAN = 500.0F;
public int smeltingTicks = 0;
public float xuanZhuan = 0.0F;
public final FluidTank gasTank;
public static final int SHI_JIAN = 2400;
public static final float DIAN = 500.0F;
public int smeltingTicks = 0;
public float xuanZhuan = 0.0F;
public final FluidTank gasTank;
public TCentrifuge() {
this.gasTank =
new FluidTank(AtomicScience.FLUID_URANIUM_HEXAFLOURIDE, 0, 5000);
}
public TCentrifuge() {
this.gasTank = new FluidTank(AtomicScience.FLUID_URANIUM_HEXAFLOURIDE, 0, 5000);
}
@Override
public ElectricityPack getRequest() {
return this.canWork()
? new ElectricityPack(500.0D / this.getVoltage(), this.getVoltage())
: new ElectricityPack();
}
@Override
public ElectricityPack getRequest() {
return this.canWork()
? new ElectricityPack(500.0D / this.getVoltage(), this.getVoltage())
: new ElectricityPack();
}
@Override
public void updateEntity() {
super.updateEntity();
if (!this.worldObj.isRemote && !this.isDisabled()) {
if (super.ticks % 20L == 0L) {
for (int i$ = 0; i$ < 6; ++i$) {
ForgeDirection direction = ForgeDirection.getOrientation(i$);
TileEntity tileEntity = VectorHelper.getTileEntityFromSide(
this.worldObj, new Vector3(this), direction);
if (tileEntity instanceof IFluidHandler &&
tileEntity.getClass() != this.getClass()) {
int requiredLiquid =
this.gasTank.getCapacity() - this.gasTank.getFluidAmount();
FluidStack drained =
((IFluidHandler)tileEntity)
.drain(
direction.getOpposite(),
new FluidStack(AtomicScience.FLUID_URANIUM_HEXAFLOURIDE,
requiredLiquid),
true);
this.gasTank.fill(drained, true);
}
}
}
if (this.canWork()) {
super.wattsReceived += ElectricItemHelper.dechargeItem(
super.containingItems[0], 500.0D, this.getVoltage());
if (super.wattsReceived >= 500.0D) {
if (this.smeltingTicks == 0) {
this.smeltingTicks = 2400;
}
if (this.smeltingTicks > 0) {
--this.smeltingTicks;
if (this.smeltingTicks < 1) {
this.work();
this.smeltingTicks = 0;
@Override
public void updateEntity() {
super.updateEntity();
if (!this.worldObj.isRemote && !this.isDisabled()) {
if (super.ticks % 20L == 0L) {
for (int i$ = 0; i$ < 6; ++i$) {
ForgeDirection direction = ForgeDirection.getOrientation(i$);
TileEntity tileEntity = VectorHelper.getTileEntityFromSide(
this.worldObj, new Vector3(this), direction);
if (tileEntity instanceof IFluidHandler &&
tileEntity.getClass() != this.getClass()) {
int requiredLiquid = this.gasTank.getCapacity() - this.gasTank.getFluidAmount();
FluidStack drained = ((IFluidHandler) tileEntity)
.drain(
direction.getOpposite(),
new FluidStack(AtomicScience.FLUID_URANIUM_HEXAFLOURIDE,
requiredLiquid),
true);
this.gasTank.fill(drained, true);
}
}
}
} else {
this.smeltingTicks = 0;
}
super.wattsReceived = 0.0D;
if (this.canWork()) {
super.wattsReceived += ElectricItemHelper.dechargeItem(
super.containingItems[0], 500.0D, this.getVoltage());
if (super.wattsReceived >= 500.0D) {
if (this.smeltingTicks == 0) {
this.smeltingTicks = 2400;
}
if (this.smeltingTicks > 0) {
--this.smeltingTicks;
if (this.smeltingTicks < 1) {
this.work();
this.smeltingTicks = 0;
}
} else {
this.smeltingTicks = 0;
}
super.wattsReceived = 0.0D;
}
} else {
this.smeltingTicks = 0;
}
if (super.ticks % 10L == 0L) {
this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
}
}
} else {
this.smeltingTicks = 0;
}
if (super.ticks % 10L == 0L) {
this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
}
}
}
@Override
public void onDataPacket(NetworkManager nm,
S35PacketUpdateTileEntity packet) {
NBTTagCompound nbt = packet.func_148857_g();
this.smeltingTicks = nbt.getInteger("shiJian");
this.gasTank.setFluid(
new FluidStack(AtomicScience.FLUID_URANIUM_HEXAFLOURIDE,
nbt.getInteger("fluidAmount")));
super.disabledTicks = nbt.getInteger("disabledTicks");
}
public Packet getDescriptionPacket() {
NBTTagCompound nbt = new NBTTagCompound();
nbt.setInteger("shiJian", this.smeltingTicks);
nbt.setInteger("fluidAmount", this.gasTank.getFluidAmount());
nbt.setInteger("disabledTicks", super.disabledTicks);
return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord,
this.getBlockMetadata(), nbt);
}
@Override
public void openInventory() {
if (!this.worldObj.isRemote) {
this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
@Override
public void onDataPacket(NetworkManager nm,
S35PacketUpdateTileEntity packet) {
NBTTagCompound nbt = packet.func_148857_g();
this.smeltingTicks = nbt.getInteger("shiJian");
this.gasTank.setFluid(
new FluidStack(AtomicScience.FLUID_URANIUM_HEXAFLOURIDE,
nbt.getInteger("fluidAmount")));
super.disabledTicks = nbt.getInteger("disabledTicks");
}
}
@Override
public void closeInventory() {}
public Packet getDescriptionPacket() {
NBTTagCompound nbt = new NBTTagCompound();
public boolean canWork() {
return !this.isDisabled() && this.gasTank.getFluidAmount() != 0 &&
this.gasTank.getFluidAmount() >=
AtomicScience.URANIUM_HEXAFLOURIDE_RATIO &&
this.isItemValidForSlot(2, new ItemStack(AtomicScience.itUranium)) &&
this.isItemValidForSlot(3,
new ItemStack(AtomicScience.itUranium, 1, 1));
}
nbt.setInteger("shiJian", this.smeltingTicks);
nbt.setInteger("fluidAmount", this.gasTank.getFluidAmount());
nbt.setInteger("disabledTicks", super.disabledTicks);
public void work() {
if (this.canWork()) {
this.gasTank.drain(AtomicScience.URANIUM_HEXAFLOURIDE_RATIO, true);
if ((double)this.worldObj.rand.nextFloat() > 0.7D) {
this.incrStackSize(2, new ItemStack(AtomicScience.itUranium));
} else {
this.incrStackSize(3, new ItemStack(AtomicScience.itUranium, 1, 1));
}
return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord,
this.getBlockMetadata(), nbt);
}
}
@Override
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
this.smeltingTicks = nbt.getInteger("smeltingTicks");
NBTTagCompound gasNbt = nbt.getCompoundTag("gas");
this.gasTank.setFluid(FluidStack.loadFluidStackFromNBT(gasNbt));
}
@Override
public void writeToNBT(NBTTagCompound nbt) {
super.writeToNBT(nbt);
nbt.setInteger("smeltingTicks", this.smeltingTicks);
NBTTagCompound gasNbt = new NBTTagCompound();
if (this.gasTank.getFluid() != null)
this.gasTank.getFluid().writeToNBT(gasNbt);
nbt.setTag("gas", gasNbt);
}
public int getSizeInventory() { return 4; }
@Override
public boolean canFill(ForgeDirection arg0, Fluid fluid) {
return AtomicScience.FLUID_URANIUM_HEXAFLOURIDE == fluid &&
this.gasTank.getCapacity() != this.gasTank.getFluidAmount();
}
@Override
public int fill(ForgeDirection from, FluidStack resource, boolean doFill) {
return AtomicScience.FLUID_URANIUM_HEXAFLOURIDE == resource.getFluid()
? this.gasTank.fill(resource, doFill)
: 0;
}
@Override
public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) {
return null;
}
@Override
public FluidStack drain(ForgeDirection arg0, FluidStack arg1, boolean arg2) {
return null;
}
@Override
public boolean canDrain(ForgeDirection arg0, Fluid arg1) {
return false;
}
@Override
public FluidTankInfo[] getTankInfo(ForgeDirection arg0) {
return new FluidTankInfo[] {new FluidTankInfo(this.gasTank)};
}
@Override
public int[] getAccessibleSlotsFromSide(int side) {
return side == 0 ? new int[] {2, 3} : new int[] {0, 1};
}
@Override
public boolean canInsertItem(int slotID, ItemStack itemStack, int side) {
return slotID == 1 && this.isItemValidForSlot(slotID, itemStack);
}
@Override
public boolean canExtractItem(int slotID, ItemStack itemstack, int j) {
return slotID == 2 || slotID == 3;
}
@Override
public boolean isItemValidForSlot(int i, ItemStack itemStack) {
switch (i) {
case 0:
return itemStack.getItem() instanceof IItemElectric;
case 1:
return true;
case 2:
return itemStack.getItem() == AtomicScience.itUranium;
case 3:
return itemStack.getItem() == AtomicScience.itUranium;
default:
return false;
@Override
public void openInventory() {
if (!this.worldObj.isRemote) {
this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
}
}
@Override
public void closeInventory() {
}
public boolean canWork() {
return !this.isDisabled() && this.gasTank.getFluidAmount() != 0 &&
this.gasTank.getFluidAmount() >= AtomicScience.URANIUM_HEXAFLOURIDE_RATIO &&
this.isItemValidForSlot(2, new ItemStack(AtomicScience.itUranium)) &&
this.isItemValidForSlot(3,
new ItemStack(AtomicScience.itUranium, 1, 1));
}
public void work() {
if (this.canWork()) {
this.gasTank.drain(AtomicScience.URANIUM_HEXAFLOURIDE_RATIO, true);
if ((double) this.worldObj.rand.nextFloat() > 0.7D) {
this.incrStackSize(2, new ItemStack(AtomicScience.itUranium));
} else {
this.incrStackSize(3, new ItemStack(AtomicScience.itUranium, 1, 1));
}
}
}
@Override
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
this.smeltingTicks = nbt.getInteger("smeltingTicks");
NBTTagCompound gasNbt = nbt.getCompoundTag("gas");
this.gasTank.setFluid(FluidStack.loadFluidStackFromNBT(gasNbt));
}
@Override
public void writeToNBT(NBTTagCompound nbt) {
super.writeToNBT(nbt);
nbt.setInteger("smeltingTicks", this.smeltingTicks);
NBTTagCompound gasNbt = new NBTTagCompound();
if (this.gasTank.getFluid() != null)
this.gasTank.getFluid().writeToNBT(gasNbt);
nbt.setTag("gas", gasNbt);
}
@Override
public int getSizeInventory() {
return 4;
}
@Override
public boolean canFill(ForgeDirection arg0, Fluid fluid) {
return AtomicScience.FLUID_URANIUM_HEXAFLOURIDE == fluid &&
this.gasTank.getCapacity() != this.gasTank.getFluidAmount();
}
@Override
public int fill(ForgeDirection from, FluidStack resource, boolean doFill) {
return AtomicScience.FLUID_URANIUM_HEXAFLOURIDE == resource.getFluid()
? this.gasTank.fill(resource, doFill)
: 0;
}
@Override
public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) {
return null;
}
@Override
public FluidStack drain(ForgeDirection arg0, FluidStack arg1, boolean arg2) {
return null;
}
@Override
public boolean canDrain(ForgeDirection arg0, Fluid arg1) {
return false;
}
@Override
public FluidTankInfo[] getTankInfo(ForgeDirection arg0) {
return new FluidTankInfo[] { new FluidTankInfo(this.gasTank) };
}
@Override
public int[] getAccessibleSlotsFromSide(int side) {
return side == 0 ? new int[] { 2, 3 } : new int[] { 0, 1 };
}
@Override
public boolean canInsertItem(int slotID, ItemStack itemStack, int side) {
return slotID == 1 && this.isItemValidForSlot(slotID, itemStack);
}
@Override
public boolean canExtractItem(int slotID, ItemStack itemstack, int j) {
return slotID == 2 || slotID == 3;
}
@Override
public boolean isItemValidForSlot(int i, ItemStack itemStack) {
switch (i) {
case 0:
return itemStack.getItem() instanceof IItemElectric;
case 1:
return true;
case 2:
return itemStack.getItem() == AtomicScience.itUranium;
case 3:
return itemStack.getItem() == AtomicScience.itUranium;
default:
return false;
}
}
}
}

View file

@ -159,6 +159,9 @@ public class TFissionReactor extends TileEntityDisableable
this.wasteTank.getFluidAmount() > this.wasteTank.getCapacity();
}
// TODO: WTF
//@Override
public void updatePositionStatus() {
boolean top = (new Vector3(this))
.add(new Vector3(0.0D, 1.0D, 0.0D))
@ -235,6 +238,7 @@ public class TFissionReactor extends TileEntityDisableable
this.readFromNBT(packet.func_148857_g());
}
@Override
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
this.wenDu = nbt.getFloat("temperature");

View file

@ -159,6 +159,7 @@ public class TNuclearBoiler
}
}
@Override
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
this.smeltingTicks = nbt.getInteger("smeltingTicks");

View file

@ -11,32 +11,32 @@ import net.minecraft.util.IIcon;
import net.minecraft.world.World;
public class BElectromagnet extends BBase implements IElectromagnet {
private IIcon iconTop;
private IIcon iconTop;
public BElectromagnet() {
super("electromagnet");
}
public BElectromagnet() { super("electromagnet"); }
@Override
public IIcon getIcon(int side, int metadata) {
return side != 0 && side != 1 ? this.blockIcon : this.iconTop;
}
@Override
public IIcon getIcon(int side, int metadata) {
return side != 0 && side != 1 ? this.blockIcon : this.iconTop;
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconRegister) {
super.registerBlockIcons(iconRegister);
this.iconTop = iconRegister.registerIcon(
this.getUnlocalizedName().replace("tile.", "") + "_top");
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconRegister) {
super.registerBlockIcons(iconRegister);
this.iconTop = iconRegister.registerIcon(
this.getUnlocalizedName().replace("tile.", "") + "_top");
this.blockIcon = iconRegister.registerIcon(
this.getUnlocalizedName().replace("tile.", ""));
}
@Override
public TileEntity createNewTileEntity(World var1, int meta) {
return new TElectromagnet();
}
@Override
public TileEntity createNewTileEntity(World var1, int meta) {
return new TElectromagnet();
}
@Override
public boolean isRunning(World world, int x, int y, int z) {
return true;
}
@Override
public boolean isRunning(World world, int x, int y, int z) {
return true;
}
}

View file

@ -12,6 +12,7 @@ import net.minecraft.world.World;
public class BElectromagnetGlass extends BBase implements IElectromagnet {
public BElectromagnetGlass() {
super("electromagnetGlass", Material.glass);
this.textureName = "atomicscience:electromagnetGlass";
}
@Override

View file

@ -11,30 +11,37 @@ import universalelectricity.core.UniversalElectricity;
import universalelectricity.prefab.block.BlockAdvanced;
public class BBase extends BlockAdvanced {
protected String textureName;
protected String textureName;
public BBase(String name, Material material) {
super(material);
this.textureName = "atomicscience:machine";
this.setBlockName("atomicscience:" + name);
this.setCreativeTab(TabAS.INSTANCE);
}
public BBase(String name) { this(name, UniversalElectricity.machine); }
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconRegister) {
if (this.getRenderType() == 0 &&
this.textureName.equals("atomicscience:machine")) {
super.registerBlockIcons(iconRegister);
} else {
this.blockIcon = iconRegister.registerIcon(this.textureName);
public BBase(String name, Material material) {
super(material);
this.textureName = "atomicscience:machine";
this.setBlockName("atomicscience:" + name);
this.setCreativeTab(TabAS.INSTANCE);
}
}
@Override
public TileEntity createNewTileEntity(World arg0, int arg1) {
return null;
}
public BBase(String name) {
this(name, UniversalElectricity.machine);
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconRegister) {
if (this.getRenderType() == 0 &&
this.textureName.equals("atomicscience:machine")) {
super.registerBlockIcons(iconRegister);
} else {
this.blockIcon = iconRegister.registerIcon(this.textureName);
}
}
@Override
public TileEntity createTileEntity(World world, int meta) {
return this.createNewTileEntity(world, meta);
}
@Override
public TileEntity createNewTileEntity(World arg0, int arg1) {
return null;
}
}

View file

@ -5,31 +5,37 @@ import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import universalelectricity.core.UniversalElectricity;
import universalelectricity.prefab.block.BlockRotatable;
public abstract class BBaseRotatable extends BlockRotatable {
protected String textureName;
protected String textureName;
public BBaseRotatable(String name, Material material) {
super(material);
this.textureName = "atomicscience:machine";
this.setBlockName("atomicscience:" + name);
this.setCreativeTab(TabAS.INSTANCE);
}
public BBaseRotatable(String name, Material material) {
super(material);
this.textureName = "atomicscience:machine";
this.setBlockName("atomicscience:" + name);
this.setCreativeTab(TabAS.INSTANCE);
}
public BBaseRotatable(String name) {
this(name, UniversalElectricity.machine);
}
public BBaseRotatable(String name) {
this(name, UniversalElectricity.machine);
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconRegister) {
if(this.getRenderType() == 0) {
super.registerBlockIcons(iconRegister);
} else {
this.blockIcon = iconRegister.registerIcon(this.textureName);
}
@Override
public TileEntity createTileEntity(World world, int meta) {
return this.createNewTileEntity(world, meta);
}
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconRegister) {
if (this.getRenderType() == 0) {
super.registerBlockIcons(iconRegister);
} else {
this.blockIcon = iconRegister.registerIcon(this.textureName);
}
}
}

View file

@ -1,7 +1,7 @@
package atomicscience.jiqi;
import atomicscience.CommonProxy;
import atomicscience.AtomicScience;
import atomicscience.CommonProxy;
import atomicscience.render.RH;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@ -11,39 +11,41 @@ import net.minecraft.world.World;
public class BChemicalExtractor extends BBaseRotatable {
public BChemicalExtractor() {
super("chemicalExtractor");
}
public BChemicalExtractor() {
super("chemicalExtractor");
}
@Override
public boolean onMachineActivated(World par1World, int x, int y, int z, EntityPlayer par5EntityPlayer, int side, float hitX, float hitY, float hitZ) {
par1World.getBlockMetadata(x, y, z);
if(!par1World.isRemote) {
par5EntityPlayer.openGui(AtomicScience.instance, CommonProxy.GuiType.DAO_CHOU_QI.ordinal(), par1World, x, y, z);
return true;
} else {
return true;
}
}
@Override
public boolean onMachineActivated(World par1World, int x, int y, int z,
EntityPlayer par5EntityPlayer, int side,
float hitX, float hitY, float hitZ) {
par1World.getBlockMetadata(x, y, z);
if (!par1World.isRemote) {
par5EntityPlayer.openGui(AtomicScience.instance,
CommonProxy.GuiType.CHEMICAL_EXTRACTOR.ordinal(),
par1World, x, y, z);
}
return true;
}
@Override
public TileEntity createNewTileEntity(World var1, int meta) {
return new TChemicalExtractor();
}
@Override
public TileEntity createNewTileEntity(World var1, int meta) {
return new TChemicalExtractor();
}
@Override
public boolean renderAsNormalBlock() {
return false;
}
@Override
public boolean renderAsNormalBlock() {
return false;
}
@Override
public boolean isOpaqueCube() {
return false;
}
@Override
public boolean isOpaqueCube() {
return false;
}
@Override
@SideOnly(Side.CLIENT)
public int getRenderType() {
return RH.BLOCK_RENDER_ID;
}
@Override
@SideOnly(Side.CLIENT)
public int getRenderType() {
return RH.BLOCK_RENDER_ID;
}
}

View file

@ -25,6 +25,8 @@ public class BFunnel extends BBase {
super.registerBlockIcons(iconRegister);
this.iconTop = iconRegister.registerIcon(
this.getUnlocalizedName().replace("tile.", "") + "_top");
this.blockIcon = iconRegister.registerIcon(
this.getUnlocalizedName().replace("tile.", ""));
}
@Override

View file

@ -16,6 +16,7 @@ public class BThermometer extends BBase {
public BThermometer() {
super("thermometer");
this.textureName = "atomicscience:thermometer";
}
@Override

View file

@ -11,35 +11,53 @@ import net.minecraft.item.ItemStack;
public class ItHazmatSuite extends ItemArmor implements IAntiPoisonArmor {
public ItHazmatSuite(ArmorMaterial par2EnumArmorMaterial, int par3,
int par4) {
super(par2EnumArmorMaterial, par3, par4);
this.setCreativeTab(TabAS.INSTANCE);
this.setMaxDamage(200000);
}
public ItHazmatSuite(ArmorMaterial par2EnumArmorMaterial, int par3,
int par4) {
super(par2EnumArmorMaterial, par3, par4);
this.setCreativeTab(TabAS.INSTANCE);
this.setMaxDamage(200000);
switch (par4) {
case 0:
this.setTextureName("atomicscience:hazmatMask");
break;
case 1:
this.setTextureName("atomicscience:hazmatBody");
break;
case 2:
this.setTextureName("atomicscience:hazmatLeggings");
break;
case 3:
this.setTextureName("atomicscience:hazmatBoots");
break;
@Override
public String getArmorTexture(ItemStack stack, Entity entity, int slot,
String layer) {
return "/assets/atomicscience/textures/models/hazmat.png";
default:
break;
}
}
@Override
public boolean isProtectedFromPoison(ItemStack itemStack,
EntityLivingBase entityLiving, Poison type) {
return type == PoisonRadiation.INSTANCE ||
type.getName().equalsIgnoreCase("chemical") ||
type.getName().equalsIgnoreCase("contagious");
}
@Override
public String getArmorTexture(ItemStack stack, Entity entity, int slot,
String layer) {
return "atomicscience:textures/models/hazmat.png";
}
@Override
public void onProtectFromPoison(ItemStack itemStack,
EntityLivingBase entityLiving, Poison type) {
itemStack.damageItem(1, entityLiving);
}
@Override
public boolean isProtectedFromPoison(ItemStack itemStack,
EntityLivingBase entityLiving,
Poison type) {
return type == PoisonRadiation.INSTANCE ||
type.getName().equalsIgnoreCase("chemical") ||
type.getName().equalsIgnoreCase("contagious");
}
@Override
public Poison.ArmorType getArmorType() {
return Poison.ArmorType.values()[super.armorType];
}
@Override
public void onProtectFromPoison(ItemStack itemStack,
EntityLivingBase entityLiving, Poison type) {
itemStack.damageItem(1, entityLiving);
}
@Override
public Poison.ArmorType getArmorType() {
return Poison.ArmorType.values()[super.armorType];
}
}

View file

@ -17,6 +17,7 @@ public class ItThermometer extends ItElectricAS {
public ItThermometer(int texture) {
super("thermometer");
this.setTextureName("atomicscience:thermometer");
}
@Override

View file

@ -207,6 +207,7 @@ public class TChemicalExtractor
return 4;
}
@Override
public boolean isItemValidForSlot(int slotID, ItemStack itemStack) {
return slotID == 1
? AtomicScience.isCellWater(itemStack)
@ -215,14 +216,17 @@ public class TChemicalExtractor
AtomicScience.isUraniumOre(itemStack));
}
@Override
public int[] getAccessibleSlotsFromSide(int side) {
return new int[] { 1, 2, 3 };
}
@Override
public boolean canInsertItem(int slotID, ItemStack itemStack, int side) {
return this.isItemValidForSlot(slotID, itemStack);
}
@Override
public boolean canExtractItem(int slotID, ItemStack itemstack, int side) {
return slotID == 2;
}

View file

@ -19,6 +19,7 @@ public class TThermometer extends TileEntityDisableable {
public float temp = 0.0F;
public Vector3 linkedTileCoords;
@Override
public void updateEntity() {
super.updateEntity();
if (!this.worldObj.isRemote) {
@ -83,12 +84,14 @@ public class TThermometer extends TileEntityDisableable {
}
}
@Override
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
this.warningTemp = nbt.getInteger("warningTemp");
this.linkedTileCoords = Vector3.readFromNBT(nbt.getCompoundTag("linkedTileCoords"));
}
@Override
public void writeToNBT(NBTTagCompound nbt) {
super.writeToNBT(nbt);
nbt.setInteger("warningTemp", this.warningTemp);

View file

@ -1,6 +1,7 @@
package atomicscience.jiqi;
import atomicscience.AtomicScience;
import atomicscience.SoundManager;
import atomicscience.api.ISteamReceptor;
import calclavia.lib.TileEntityUniversalProducer;
import cpw.mods.fml.relauncher.Side;
@ -22,254 +23,255 @@ import net.minecraftforge.fluids.IFluidHandler;
import universalelectricity.core.vector.Vector3;
public class TTurbine extends TileEntityUniversalProducer
implements ISteamReceptor, IFluidHandler {
public float rotation = 0.0F;
public float speed = 0.0F;
public boolean isMultiblock = false;
public Vector3 masterTurbine = null;
public static final int BAN_JING = 1;
// private static final double MAX_XUAN_ZHUAN = 50.0D;
// private static final float ZHUAN_MAN = 0.5F;
public final FluidTank tank;
implements ISteamReceptor, IFluidHandler {
public float rotation = 0.0F;
public float speed = 0.0F;
public boolean isMultiblock = false;
public Vector3 masterTurbine = null;
public static final int BAN_JING = 1;
// private static final double MAX_XUAN_ZHUAN = 50.0D;
// private static final float ZHUAN_MAN = 0.5F;
public final FluidTank tank;
public TTurbine() {
this.tank = new FluidTank(AtomicScience.FLUID_STEAM, 0, 20000);
}
@Override
public boolean canConnect(ForgeDirection direction) {
return this.masterTurbine != null ? false : direction == ForgeDirection.UP;
}
@Override
public void updateEntity() {
super.updateEntity();
if (this.tank.getFluid() != null &&
this.tank.getFluidAmount() > AtomicScience.STEAM_RATIO) {
this.onReceiveSteam(AtomicScience.STEAM_RATIO);
this.tank.drain(AtomicScience.STEAM_RATIO, true);
public TTurbine() {
this.tank = new FluidTank(AtomicScience.FLUID_STEAM, 0, 20000);
}
if (this.masterTurbine != null) {
TileEntity tileEntity = this.masterTurbine.getTileEntity(this.worldObj);
if (tileEntity == null) {
this.masterTurbine = null;
} else if (!tileEntity.isInvalid() && tileEntity instanceof TTurbine) {
if (!((TTurbine)tileEntity).isMultiblock) {
this.masterTurbine = null;
}
} else {
this.masterTurbine = null;
}
} else {
if (this.speed > 0.0F && !this.isDisabled()) {
if (super.ticks % 18L == 0L) {
if (this.isMultiblock) {
this.worldObj.playSoundEffect(
(double)this.xCoord, (double)this.yCoord, (double)this.zCoord,
"atomicscience.turbine", 0.6F,
(float)(0.699999988079071D +
0.2D * ((double)this.speed / 450.0D)));
} else {
this.worldObj.playSoundEffect(
(double)this.xCoord, (double)this.yCoord, (double)this.zCoord,
"atomicscience.turbine", 0.15F,
(float)(0.699999988079071D +
0.2D * ((double)this.speed / 50.0D)));
}
@Override
public boolean canConnect(ForgeDirection direction) {
return this.masterTurbine != null ? false : direction == ForgeDirection.UP;
}
@Override
public void updateEntity() {
super.updateEntity();
if (this.tank.getFluid() != null &&
this.tank.getFluidAmount() > AtomicScience.STEAM_RATIO) {
this.onReceiveSteam(AtomicScience.STEAM_RATIO);
this.tank.drain(AtomicScience.STEAM_RATIO, true);
}
// If turbine doesn't spin, check packet handler
// Original packet handler added to rotation on packet received.
// - LordMZTE
if (this.isMultiblock) {
this.rotation += this.speed / 18.0F / 3.0F;
if (this.masterTurbine != null) {
TileEntity tileEntity = this.masterTurbine.getTileEntity(this.worldObj);
if (tileEntity == null) {
this.masterTurbine = null;
} else if (!tileEntity.isInvalid() && tileEntity instanceof TTurbine) {
if (!((TTurbine) tileEntity).isMultiblock) {
this.masterTurbine = null;
}
} else {
this.masterTurbine = null;
}
} else {
this.rotation += this.speed / 3.0F;
}
if (this.speed > 0.0F && !this.isDisabled()) {
if (super.ticks % 18L == 0L) {
if (this.isMultiblock) {
this.worldObj.playSoundEffect(
(double) this.xCoord, (double) this.yCoord, (double) this.zCoord,
SoundManager.TURBINE, 0.6F,
(float) (0.699999988079071D +
0.2D * ((double) this.speed / 450.0D)));
} else {
this.worldObj.playSoundEffect(
(double) this.xCoord, (double) this.yCoord, (double) this.zCoord,
SoundManager.TURBINE, 0.15F,
(float) (0.699999988079071D +
0.2D * ((double) this.speed / 50.0D)));
}
}
if (!this.worldObj.isRemote && super.ticks % 3L == 0L) {
this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord,
this.zCoord);
}
// If turbine doesn't spin, check packet handler
// Original packet handler added to rotation on packet received.
// - LordMZTE
if (this.isMultiblock) {
this.rotation += this.speed / 18.0F / 3.0F;
} else {
this.rotation += this.speed / 3.0F;
}
if (this.rotation > 360.0F) {
this.rotation = 0.0F;
}
}
if (!this.worldObj.isRemote && super.ticks % 3L == 0L) {
this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord,
this.zCoord);
}
this.produce(
(double)(this.speed * AtomicScience.WOLUN_MULTIPLIER_OUTPUT));
if (this.isMultiblock) {
this.speed = (float)Math.max(
Math.min((double)(this.speed - 4.5F), 450.0D), 0.0D);
} else {
this.speed =
(float)Math.max(Math.min((double)(this.speed - 0.5F), 50.0D), 0.0D);
}
}
}
public void onReceiveSteam(int amount) {
if (this.masterTurbine != null) {
TileEntity tileEntity = this.masterTurbine.getTileEntity(this.worldObj);
if (tileEntity != null && tileEntity instanceof TTurbine) {
((TTurbine)tileEntity).onReceiveSteam(amount);
}
} else if (this.isMultiblock) {
this.speed =
(float)Math.min((double)(this.speed + (float)amount), 450.0D);
} else {
this.speed = (float)Math.min((double)(this.speed + (float)amount), 50.0D);
}
}
@Override
public void onDataPacket(NetworkManager arg0,
S35PacketUpdateTileEntity arg1) {
NBTTagCompound nbt = arg1.func_148857_g();
this.isMultiblock = nbt.getBoolean("isMultiblock");
this.masterTurbine = Vector3.readFromNBT(new NBTTagCompound());
this.speed = nbt.getFloat("speed");
}
@Override
public Packet getDescriptionPacket() {
NBTTagCompound nbt = new NBTTagCompound();
nbt.setBoolean("isMultiblock", this.isMultiblock);
nbt.setTag("masterTurbine",
this.masterTurbine.writeToNBT(new NBTTagCompound()));
nbt.setFloat("speed", this.speed);
return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord,
this.getBlockMetadata(), nbt);
}
public void setMaster(TTurbine newMasterTurbine) {
if (newMasterTurbine != null) {
this.masterTurbine = new Vector3(newMasterTurbine);
} else {
this.masterTurbine = null;
this.isMultiblock = false;
}
this.worldObj.notifyBlocksOfNeighborChange(
this.xCoord, this.yCoord, this.zCoord, this.getBlockType());
if (!this.worldObj.isRemote) {
this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
}
}
public boolean hasMaster() { return this.masterTurbine != null; }
public boolean checkMultiblock() {
if (!this.worldObj.isRemote) {
ArrayList<TTurbine> xiaoWoLun = new ArrayList<>();
ArrayList<TTurbine> lianJie = new ArrayList<>();
for (int i$ = -1; i$ <= 1; ++i$) {
for (int woLun = -1; woLun <= 1; ++woLun) {
TileEntity tileEntity = this.worldObj.getTileEntity(
this.xCoord + i$, this.yCoord, this.zCoord + woLun);
if (tileEntity != null && tileEntity instanceof TTurbine) {
if (!((TTurbine)tileEntity).hasMaster() &&
!((TTurbine)tileEntity).isMultiblock) {
xiaoWoLun.add((TTurbine)tileEntity);
if (this.rotation > 360.0F) {
this.rotation = 0.0F;
}
}
lianJie.add((TTurbine)tileEntity);
}
this.produce(
(double) (this.speed * AtomicScience.WOLUN_MULTIPLIER_OUTPUT));
if (this.isMultiblock) {
this.speed = (float) Math.max(
Math.min((double) (this.speed - 4.5F), 450.0D), 0.0D);
} else {
this.speed = (float) Math.max(Math.min((double) (this.speed - 0.5F), 50.0D), 0.0D);
}
}
}
Iterator var6;
TTurbine var7;
if (this.isMultiblock) {
var6 = lianJie.iterator();
while (var6.hasNext()) {
var7 = (TTurbine)var6.next();
if (var7 != this) {
var7.setMaster((TTurbine)null);
}
}
this.isMultiblock = false;
} else if (xiaoWoLun.size() >= 9) {
var6 = xiaoWoLun.iterator();
while (var6.hasNext()) {
var7 = (TTurbine)var6.next();
if (var7 != this) {
var7.setMaster(this);
}
}
this.masterTurbine = null;
this.isMultiblock = true;
}
if (!this.worldObj.isRemote) {
this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
}
}
return true;
}
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
this.speed = nbt.getFloat("speed");
this.isMultiblock = nbt.getBoolean("isMultiblock");
if (nbt.hasKey("masterTurbine")) {
this.masterTurbine =
Vector3.readFromNBT(nbt.getCompoundTag("masterTurbine"));
} else {
this.masterTurbine = null;
public void onReceiveSteam(int amount) {
if (this.masterTurbine != null) {
TileEntity tileEntity = this.masterTurbine.getTileEntity(this.worldObj);
if (tileEntity != null && tileEntity instanceof TTurbine) {
((TTurbine) tileEntity).onReceiveSteam(amount);
}
} else if (this.isMultiblock) {
this.speed = (float) Math.min((double) (this.speed + (float) amount), 450.0D);
} else {
this.speed = (float) Math.min((double) (this.speed + (float) amount), 50.0D);
}
}
}
public void writeToNBT(NBTTagCompound nbt) {
super.writeToNBT(nbt);
nbt.setFloat("speed", this.speed);
nbt.setBoolean("isMultiblock", this.isMultiblock);
if (this.masterTurbine != null) {
nbt.setTag("masterTurbine",
this.masterTurbine.writeToNBT(new NBTTagCompound()));
@Override
public void onDataPacket(NetworkManager arg0,
S35PacketUpdateTileEntity arg1) {
NBTTagCompound nbt = arg1.func_148857_g();
this.isMultiblock = nbt.getBoolean("isMultiblock");
if (nbt.getTag("masterTurbine") != null)
this.masterTurbine = Vector3.readFromNBT(nbt.getCompoundTag("masterTurbine"));
this.speed = nbt.getFloat("speed");
}
}
public int fill(ForgeDirection from, FluidStack resource, boolean doFill) {
return this.tank.fill(resource, doFill);
}
@Override
public Packet getDescriptionPacket() {
NBTTagCompound nbt = new NBTTagCompound();
nbt.setBoolean("isMultiblock", this.isMultiblock);
if (this.masterTurbine != null)
nbt.setTag("masterTurbine",
this.masterTurbine.writeToNBT(new NBTTagCompound()));
nbt.setFloat("speed", this.speed);
public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) {
return null;
}
return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord,
this.getBlockMetadata(), nbt);
}
@SideOnly(Side.CLIENT)
public AxisAlignedBB getRenderBoundingBox() {
return TileEntity.INFINITE_EXTENT_AABB;
}
public void setMaster(TTurbine newMasterTurbine) {
if (newMasterTurbine != null) {
this.masterTurbine = new Vector3(newMasterTurbine);
} else {
this.masterTurbine = null;
this.isMultiblock = false;
}
@Override
public boolean canDrain(ForgeDirection arg0, Fluid arg1) {
return false;
}
this.worldObj.notifyBlocksOfNeighborChange(
this.xCoord, this.yCoord, this.zCoord, this.getBlockType());
if (!this.worldObj.isRemote) {
this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
}
}
@Override
public boolean canFill(ForgeDirection arg0, Fluid arg1) {
return arg1 == AtomicScience.FLUID_STEAM &&
this.tank.getFluidAmount() < this.tank.getCapacity();
}
public boolean hasMaster() {
return this.masterTurbine != null;
}
@Override
public FluidStack drain(ForgeDirection arg0, FluidStack arg1, boolean arg2) {
return null;
}
public boolean checkMultiblock() {
if (!this.worldObj.isRemote) {
ArrayList<TTurbine> xiaoWoLun = new ArrayList<>();
ArrayList<TTurbine> lianJie = new ArrayList<>();
@Override
public FluidTankInfo[] getTankInfo(ForgeDirection arg0) {
return new FluidTankInfo[] {new FluidTankInfo(this.tank)};
}
for (int i$ = -1; i$ <= 1; ++i$) {
for (int woLun = -1; woLun <= 1; ++woLun) {
TileEntity tileEntity = this.worldObj.getTileEntity(
this.xCoord + i$, this.yCoord, this.zCoord + woLun);
if (tileEntity != null && tileEntity instanceof TTurbine) {
if (!((TTurbine) tileEntity).hasMaster() &&
!((TTurbine) tileEntity).isMultiblock) {
xiaoWoLun.add((TTurbine) tileEntity);
}
lianJie.add((TTurbine) tileEntity);
}
}
}
Iterator var6;
TTurbine var7;
if (this.isMultiblock) {
var6 = lianJie.iterator();
while (var6.hasNext()) {
var7 = (TTurbine) var6.next();
if (var7 != this) {
var7.setMaster((TTurbine) null);
}
}
this.isMultiblock = false;
} else if (xiaoWoLun.size() >= 9) {
var6 = xiaoWoLun.iterator();
while (var6.hasNext()) {
var7 = (TTurbine) var6.next();
if (var7 != this) {
var7.setMaster(this);
}
}
this.masterTurbine = null;
this.isMultiblock = true;
}
if (!this.worldObj.isRemote) {
this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
}
}
return true;
}
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
this.speed = nbt.getFloat("speed");
this.isMultiblock = nbt.getBoolean("isMultiblock");
if (nbt.hasKey("masterTurbine")) {
this.masterTurbine = Vector3.readFromNBT(nbt.getCompoundTag("masterTurbine"));
} else {
this.masterTurbine = null;
}
}
public void writeToNBT(NBTTagCompound nbt) {
super.writeToNBT(nbt);
nbt.setFloat("speed", this.speed);
nbt.setBoolean("isMultiblock", this.isMultiblock);
if (this.masterTurbine != null) {
nbt.setTag("masterTurbine",
this.masterTurbine.writeToNBT(new NBTTagCompound()));
}
}
public int fill(ForgeDirection from, FluidStack resource, boolean doFill) {
return this.tank.fill(resource, doFill);
}
public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) {
return null;
}
@SideOnly(Side.CLIENT)
public AxisAlignedBB getRenderBoundingBox() {
return TileEntity.INFINITE_EXTENT_AABB;
}
@Override
public boolean canDrain(ForgeDirection arg0, Fluid arg1) {
return false;
}
@Override
public boolean canFill(ForgeDirection arg0, Fluid arg1) {
return arg1 == AtomicScience.FLUID_STEAM &&
this.tank.getFluidAmount() < this.tank.getCapacity();
}
@Override
public FluidStack drain(ForgeDirection arg0, FluidStack arg1, boolean arg2) {
return null;
}
@Override
public FluidTankInfo[] getTankInfo(ForgeDirection arg0) {
return new FluidTankInfo[] { new FluidTankInfo(this.tank) };
}
}

View file

@ -1,81 +1,84 @@
package atomicscience.shimian;
import atomicscience.AtomicScience;
import atomicscience.PAutoBuilder;
import atomicscience.TAutoBuilder;
import calclavia.lib.gui.GuiScreenBase;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiTextField;
import net.minecraft.tileentity.TileEntity;
import universalelectricity.core.vector.Vector3;
public class GAutoBuilder extends GuiScreenBase {
private TileEntity tileEntity;
private GuiTextField tfBbanJing;
private TAutoBuilder.AutoBuilderType mode = TAutoBuilder.AutoBuilderType.get(0);
private TileEntity tileEntity;
private GuiTextField tfBbanJing;
private TAutoBuilder.AutoBuilderType mode = TAutoBuilder.AutoBuilderType.get(0);
public GAutoBuilder(TileEntity tileEntity) { this.tileEntity = tileEntity; }
@Override
public void initGui() {
super.initGui();
this.tfBbanJing = new GuiTextField(this.fontRendererObj, 45, 58, 50, 12);
this.buttonList.add(new GuiButton(0, this.width / 2 - 80,
this.height / 2 - 10, 58, 20, "Build"));
this.buttonList.add(new GuiButton(1, this.width / 2 - 50,
this.height / 2 - 35, 120, 20, "Mode"));
}
@Override
protected void drawForegroundLayer(int x, int y, float var1) {
this.fontRendererObj.drawString("Auto Builder", 60, 6, 4210752);
this.fontRendererObj.drawString("This is a creative only cheat", 9, 20,
4210752);
this.fontRendererObj.drawString("which allows you to auto build", 9, 30,
4210752);
this.fontRendererObj.drawString("structures for testing.", 9, 40, 4210752);
this.fontRendererObj.drawString("Radius: ", 9, 60, 4210752);
this.tfBbanJing.drawTextBox();
((GuiButton)this.buttonList.get(1)).displayString = this.mode.name;
this.fontRendererObj.drawString("Mode: ", 9, 80, 4210752);
super.drawForegroundLayer(x, y, var1);
this.fontRendererObj.drawString("Warning!", 9, 130, 4210752);
this.fontRendererObj.drawString("This will replace blocks without", 9, 140,
4210752);
this.fontRendererObj.drawString("dropping it! You may lose items.", 9, 150,
4210752);
}
@Override
protected void keyTyped(char par1, int par2) {
super.keyTyped(par1, par2);
this.tfBbanJing.textboxKeyTyped(par1, par2);
}
@Override
protected void mouseClicked(int x, int y, int par3) {
super.mouseClicked(x, y, par3);
this.tfBbanJing.mouseClicked(x - super.containerWidth,
y - super.containerHeight, par3);
}
@Override
protected void actionPerformed(GuiButton par1GuiButton) {
super.actionPerformed(par1GuiButton);
if (par1GuiButton.id == 0) {
int radius = 0;
try {
radius = Integer.parseInt(this.tfBbanJing.getText());
} catch (Exception var4) {
;
}
if (radius > 0) {
// TODO: WTF
// PacketDispatcher.sendPacketToServer(PacketManager.getPacket("AtomicScience",
// this.tileEntity, new Object[]{Integer.valueOf(this.mode.ordinal()),
// Integer.valueOf(radius)}));
}
} else if (par1GuiButton.id == 1) {
this.mode = this.mode.next();
public GAutoBuilder(TileEntity tileEntity) {
this.tileEntity = tileEntity;
}
@Override
public void initGui() {
super.initGui();
this.tfBbanJing = new GuiTextField(this.fontRendererObj, 45, 58, 50, 12);
this.buttonList.add(new GuiButton(0, this.width / 2 - 80,
this.height / 2 - 10, 58, 20, "Build"));
this.buttonList.add(new GuiButton(1, this.width / 2 - 50,
this.height / 2 - 35, 120, 20, "Mode"));
}
@Override
protected void drawForegroundLayer(int x, int y, float var1) {
this.fontRendererObj.drawString("Auto Builder", 60, 6, 4210752);
this.fontRendererObj.drawString("This is a creative only cheat", 9, 20,
4210752);
this.fontRendererObj.drawString("which allows you to auto build", 9, 30,
4210752);
this.fontRendererObj.drawString("structures for testing.", 9, 40, 4210752);
this.fontRendererObj.drawString("Radius: ", 9, 60, 4210752);
this.tfBbanJing.drawTextBox();
((GuiButton) this.buttonList.get(1)).displayString = this.mode.name;
this.fontRendererObj.drawString("Mode: ", 9, 80, 4210752);
super.drawForegroundLayer(x, y, var1);
this.fontRendererObj.drawString("Warning!", 9, 130, 4210752);
this.fontRendererObj.drawString("This will replace blocks without", 9, 140,
4210752);
this.fontRendererObj.drawString("dropping it! You may lose items.", 9, 150,
4210752);
}
@Override
protected void keyTyped(char par1, int par2) {
super.keyTyped(par1, par2);
this.tfBbanJing.textboxKeyTyped(par1, par2);
}
@Override
protected void mouseClicked(int x, int y, int par3) {
super.mouseClicked(x, y, par3);
this.tfBbanJing.mouseClicked(x - super.containerWidth,
y - super.containerHeight, par3);
}
@Override
protected void actionPerformed(GuiButton par1GuiButton) {
super.actionPerformed(par1GuiButton);
if (par1GuiButton.id == 0) {
int radius = 0;
try {
radius = Integer.parseInt(this.tfBbanJing.getText());
} catch (Exception var4) {
;
}
if (radius > 0) {
AtomicScience.channel.sendToServer(
new PAutoBuilder(new Vector3(this.tileEntity), this.mode, radius));
}
} else if (par1GuiButton.id == 1) {
this.mode = this.mode.next();
}
}
}
}

View file

@ -6,10 +6,10 @@ import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.StatCollector;
import universalelectricity.core.electricity.ElectricityDisplay;
public class GChemicalReactor extends GBase {
public class GChemicalExtractor extends GBase {
private TChemicalExtractor tileEntity;
public GChemicalReactor(InventoryPlayer par1InventoryPlayer,
public GChemicalExtractor(InventoryPlayer par1InventoryPlayer,
TChemicalExtractor tileEntity) {
super(new CChemicalExtractor(par1InventoryPlayer, tileEntity));
this.tileEntity = tileEntity;

View file

@ -14,6 +14,7 @@ public class ItBreederFuel extends ItRadioactive implements IFissileMaterial {
this.setMaxDamage('\u9c40');
this.setMaxStackSize(1);
this.setNoRepair();
this.setTextureName("atomicscience:rodBreederFuel");
}
public int onFissile(ITemperature reactor) {

View file

@ -1,7 +1,8 @@
package atomicscience.wujian;
public class ItCell extends ItAS {
public ItCell(String name) {
super(name);
}
public ItCell(String name) {
super(name);
this.setTextureName("atomicscience:" + name);
}
}

View file

@ -25,6 +25,7 @@ public class ItFissileFuel extends ItRadioactive implements IFissileMaterial {
this.setMaxDamage('\uc350');
this.setMaxStackSize(1);
this.setNoRepair();
this.setTextureName("atomicscience:rodFissileFuel");
}
@Override

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB