mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
commit
7688d39019
@ -293,6 +293,7 @@ public class ModBlocks {
|
||||
public static Block deco_rbmk_smooth;
|
||||
|
||||
public static Block deco_emitter;
|
||||
public static Block part_emitter;
|
||||
public static Block deco_loot;
|
||||
public static Block bobblehead;
|
||||
public static Block snowglobe;
|
||||
@ -1465,6 +1466,7 @@ public class ModBlocks {
|
||||
deco_rbmk_smooth = new BlockGeneric(Material.iron).setBlockName("deco_rbmk_smooth").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":rbmk/rbmk_top");
|
||||
|
||||
deco_emitter = new BlockEmitter().setBlockName("deco_emitter").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(20.0F).setBlockTextureName(RefStrings.MODID + ":emitter");
|
||||
part_emitter = new PartEmitter().setBlockName("part_emitter").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(20.0F).setBlockTextureName(RefStrings.MODID + ":part_top");
|
||||
deco_loot = new BlockLoot().setBlockName("deco_loot").setCreativeTab(null).setHardness(0.0F).setResistance(0.0F).setBlockTextureName(RefStrings.MODID + ":block_steel");
|
||||
bobblehead = new BlockBobble().setBlockName("bobblehead").setCreativeTab(MainRegistry.blockTab).setHardness(0.0F).setResistance(0.0F).setBlockTextureName(RefStrings.MODID + ":block_steel");
|
||||
snowglobe = new BlockSnowglobe().setBlockName("snowglobe").setCreativeTab(MainRegistry.blockTab).setHardness(0.0F).setResistance(0.0F).setBlockTextureName(RefStrings.MODID + ":glass_boron");
|
||||
@ -2589,6 +2591,7 @@ public class ModBlocks {
|
||||
GameRegistry.registerBlock(deco_beryllium, deco_beryllium.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(deco_asbestos, deco_asbestos.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(deco_emitter, ItemBlockBase.class, deco_emitter.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(part_emitter, ItemBlockBase.class, part_emitter.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(deco_loot, deco_loot.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(bobblehead, ItemBlockMeta.class, bobblehead.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(snowglobe, ItemBlockMeta.class, snowglobe.getUnlocalizedName());
|
||||
|
||||
234
src/main/java/com/hbm/blocks/generic/PartEmitter.java
Normal file
234
src/main/java/com/hbm/blocks/generic/PartEmitter.java
Normal file
@ -0,0 +1,234 @@
|
||||
package com.hbm.blocks.generic;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.blocks.ITooltipProvider;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.packet.AuxParticlePacketNT;
|
||||
import com.hbm.packet.NBTPacket;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.tileentity.INBTPacketReceiver;
|
||||
import com.hbm.util.ParticleUtil;
|
||||
|
||||
import api.hbm.block.IToolable;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.BlockPistonBase;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemDye;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class PartEmitter extends BlockContainer implements IToolable, ITooltipProvider {
|
||||
|
||||
public PartEmitter() {
|
||||
super(Material.iron);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return new TileEntityPartEmitter();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack) {
|
||||
|
||||
int l = BlockPistonBase.determineOrientation(world, x, y, z, player);
|
||||
world.setBlockMetadataWithNotify(x, y, z, l, 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int i, float fx, float fy, float fz) {
|
||||
|
||||
if(world.isRemote)
|
||||
return true;
|
||||
|
||||
TileEntityPartEmitter te = (TileEntityPartEmitter)world.getTileEntity(x, y, z);
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onScrew(World world, EntityPlayer player, int x, int y, int z, int side, float fX, float fY, float fZ, ToolType tool) {
|
||||
|
||||
TileEntityPartEmitter te = (TileEntityPartEmitter)world.getTileEntity(x, y, z);
|
||||
if(tool == ToolType.HAND_DRILL) {
|
||||
te.effect = (te.effect + 1) % te.effectCount;
|
||||
te.markDirty();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static class TileEntityPartEmitter extends TileEntity implements INBTPacketReceiver {
|
||||
|
||||
public static final int range = 100;
|
||||
public int effect = 0;
|
||||
public String type;
|
||||
public float lift;
|
||||
public int life;
|
||||
public int color;
|
||||
public float max;
|
||||
public float base;
|
||||
public double posX;
|
||||
public double posY;
|
||||
public double posZ;
|
||||
public static final int effectCount = 5;
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata());
|
||||
|
||||
|
||||
if(worldObj.getTotalWorldTime() % 20 == 0) {
|
||||
for(int i = 1; i <= range; i++) {
|
||||
|
||||
|
||||
int x = xCoord + dir.offsetX * i;
|
||||
int y = yCoord + dir.offsetY * i;
|
||||
int z = zCoord + dir.offsetZ * i;
|
||||
|
||||
Block b = worldObj.getBlock(x, y, z);
|
||||
if(b.isBlockSolid(worldObj, x, y, z, dir.ordinal())) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
//NBTTagCompound data = new NBTTagCompound();
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
if(effect == 1) {
|
||||
|
||||
data.setInteger("effect", this.effect);
|
||||
ParticleUtil.spawnGasFlame(worldObj, xCoord + worldObj.rand.nextDouble(), yCoord + 4.5 + worldObj.rand.nextDouble(), zCoord + worldObj.rand.nextDouble(), worldObj.rand.nextGaussian() * 0.2, 0.1, worldObj.rand.nextGaussian() * 0.2);
|
||||
|
||||
}
|
||||
|
||||
if(effect == 2) {
|
||||
|
||||
data.setInteger("effect", this.effect);
|
||||
data.setString("type", "tower");
|
||||
data.setFloat("lift", 5F);
|
||||
data.setFloat("base", 0.25F);
|
||||
data.setFloat("max", 5F);
|
||||
data.setInteger("life", 560 + worldObj.rand.nextInt(20));
|
||||
data.setInteger("color",0x404040);
|
||||
|
||||
data.setDouble("posX", xCoord + 0.5);
|
||||
data.setDouble("posZ", zCoord + 0.5);
|
||||
data.setDouble("posY", yCoord);
|
||||
MainRegistry.proxy.effectNT(data);
|
||||
//PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, xCoord + 0.5, yCoord + 1, zCoord + 0.5), new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 150));
|
||||
}
|
||||
if(effect == 3) {
|
||||
data.setInteger("effect",this.effect);
|
||||
data.setString("type", "tower");
|
||||
data.setFloat("lift", 0.5F);
|
||||
data.setFloat("base", 1F);
|
||||
data.setFloat("max", 10F);
|
||||
data.setInteger("life", 750 + worldObj.rand.nextInt(250));
|
||||
|
||||
data.setDouble("posX", xCoord + 0.5 + worldObj.rand.nextDouble() * 3 - 1.5);
|
||||
data.setDouble("posZ", zCoord + 0.5 + worldObj.rand.nextDouble() * 3 - 1.5);
|
||||
data.setDouble("posY", yCoord + 1);
|
||||
|
||||
MainRegistry.proxy.effectNT(data);
|
||||
|
||||
}
|
||||
if(effect == 4) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
data.setInteger("effect", this.effect);
|
||||
PacketDispatcher.wrapper.sendToAllAround(new NBTPacket(data, xCoord, yCoord, zCoord), new TargetPoint(this.worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 150));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Packet getDescriptionPacket() {
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
this.writeToNBT(nbt);
|
||||
return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 0, nbt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
|
||||
this.readFromNBT(pkt.func_148857_g());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
this.effect = nbt.getInteger("effect");
|
||||
this.type = nbt.getString("type");
|
||||
this.color = nbt.getInteger("color");
|
||||
this.life = nbt.getInteger("life");
|
||||
this.max = nbt.getFloat("max");
|
||||
this.base = nbt.getFloat("base");
|
||||
this.posX = nbt.getDouble("posX");
|
||||
this.posY = nbt.getDouble("posY");
|
||||
this.posZ = nbt.getDouble("posZ");
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
nbt.setInteger("effect", this.effect);
|
||||
nbt.setString("type", "tower");
|
||||
nbt.setFloat("lift", 1F);
|
||||
nbt.setFloat("base", 0.25F);
|
||||
nbt.setFloat("max", 3F);
|
||||
nbt.setInteger("life", 150 + worldObj.rand.nextInt(20));
|
||||
nbt.setInteger("color",0x404040);
|
||||
|
||||
nbt.setDouble("posX", xCoord + 0.5);
|
||||
nbt.setDouble("posZ", zCoord + 0.5);
|
||||
nbt.setDouble("posY", yCoord);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getRenderBoundingBox() {
|
||||
return TileEntity.INFINITE_EXTENT_AABB;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public double getMaxRenderDistanceSquared() {
|
||||
return 65536.0D;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void networkUnpack(NBTTagCompound nbt) {
|
||||
this.effect = nbt.getInteger("effect");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean ext) {
|
||||
list.add(EnumChatFormatting.GOLD + "Use hand drill to cycle special effects");
|
||||
}
|
||||
}
|
||||
@ -11,6 +11,7 @@ import com.hbm.blocks.generic.BlockEmitter.TileEntityEmitter;
|
||||
import com.hbm.blocks.generic.BlockLoot.TileEntityLoot;
|
||||
import com.hbm.blocks.generic.BlockMotherOfAllOres.TileEntityRandomOre;
|
||||
import com.hbm.blocks.generic.BlockSnowglobe.TileEntitySnowglobe;
|
||||
import com.hbm.blocks.generic.PartEmitter.TileEntityPartEmitter;
|
||||
import com.hbm.blocks.machine.MachineFan.TileEntityFan;
|
||||
import com.hbm.blocks.machine.WatzPump.TileEntityWatzPump;
|
||||
import com.hbm.blocks.network.BlockCablePaintable.TileEntityCablePaintable;
|
||||
@ -78,6 +79,7 @@ public class TileMappings {
|
||||
put(TileEntityMachineTeleporter.class, "tileentity_teleblock");
|
||||
put(TileEntityHatch.class, "tileentity_seal_lid");
|
||||
put(TileEntityMachineIGenerator.class, "tileentity_igenerator");
|
||||
put(TileEntityPartEmitter.class, "tileentity_partemitter");
|
||||
put(TileEntityDummy.class, "tileentity_dummy");
|
||||
put(TileEntityMachineCyclotron.class, "tileentity_cyclotron");
|
||||
put(TileEntityOilDuct.class, "tileentity_oil_duct");
|
||||
|
||||
@ -4441,6 +4441,7 @@ tile.deco_asbestos.name=Asbestos Roof
|
||||
tile.deco_beryllium.name=Beryllium Deco Block
|
||||
tile.deco_computer.ibm_300pl.name=IBM Personal Computer 300PL
|
||||
tile.deco_emitter.name=Deco Light Emitter
|
||||
tile.part_emitter.name=Deco Particle Emitter
|
||||
tile.deco_lead.name=Lead Deco Block
|
||||
tile.deco_rbmk.name=RBMK Deco Block
|
||||
tile.deco_rbmk_smooth.name=Smooth RBMK Deco Block
|
||||
|
||||
@ -2953,6 +2953,7 @@ tile.block_cap_sunset.name=Блок крышек от Сансет Сарсап
|
||||
tile.block_tritium.name=Блок тритиевых пробирок
|
||||
tile.hazmat.name=Блок защитной ткани
|
||||
tile.deco_emitter.name=Декоративный источник света
|
||||
tile.part_emitter.name=Декоративный источник частиц
|
||||
tile.plant_flower.foxglove.name=Наперстянка
|
||||
tile.plant_flower.nightshade.name=Белладонна
|
||||
tile.plant_flower.tobacco.name=Табак
|
||||
|
||||
BIN
src/main/resources/assets/hbm/textures/blocks/part_top.png
Normal file
BIN
src/main/resources/assets/hbm/textures/blocks/part_top.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 251 B |
Loading…
x
Reference in New Issue
Block a user