mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
Corrupted broadcaster
This commit is contained in:
parent
0d9490b860
commit
ed14c30bd3
@ -133,6 +133,7 @@ death.attack.blackhole=%1$s wurde spaghettifiziert.
|
||||
death.attack.blender=%1$s wurde in kleine, mundgerechte Stücke geschnitten.
|
||||
death.attack.meteorite=%1$s wurde von einem fallenden Stein aus dem Weltall erschlagen.
|
||||
death.attack.boxcar=%1$s wurde von einem fallenden Güterwagon zermatscht. Autsch!
|
||||
death.attack.broadcast=%1$s wurde das Gehirn geschmolzen.
|
||||
|
||||
item.redstone_sword.name=Redstoneschwert
|
||||
item.big_sword.name=Großes Schwert
|
||||
@ -303,6 +304,8 @@ container.siren=Sirene
|
||||
tile.machine_radgen.name=Strahlenbetriebener Generator [WIP]
|
||||
container.radGen=Strahlenbetriebener Generator [WIP]
|
||||
|
||||
tile.broadcaster_pc.name=Korrupter Sender
|
||||
|
||||
tile.red_pylon.name=Strommasten
|
||||
item.wiring_red_copper.name=Kabeltrommel
|
||||
|
||||
|
||||
@ -133,6 +133,7 @@ death.attack.blackhole=%1$s was spaghettified.
|
||||
death.attack.blender=%1$s was chopped in small, bite-sized pieces.
|
||||
death.attack.meteorite=%1$s was hit by a falling rock from outer space.
|
||||
death.attack.boxcar=%1$s was smushed by a falling boxcar. Oh well.
|
||||
death.attack.broadcast=%1$s got their brain melted.
|
||||
|
||||
item.redstone_sword.name=Redstone Sword
|
||||
item.big_sword.name=Great Sword
|
||||
@ -303,6 +304,8 @@ container.siren=Siren
|
||||
tile.machine_radgen.name=Radiation-Powered Engine [WIP]
|
||||
container.radGen=Radiation-Powered Engine [WIP]
|
||||
|
||||
tile.broadcaster_pc.name=Corrupted Broadcaster
|
||||
|
||||
tile.red_pylon.name=Electricity Pole
|
||||
item.wiring_red_copper.name=Cable Drum
|
||||
|
||||
|
||||
@ -13,6 +13,9 @@
|
||||
"block.igeneratorOperate": {"category": "block", "sounds": [{"name": "block/igeneratorOperate", "stream": false}]},
|
||||
"block.turbofanOperate": {"category": "block", "sounds": [{"name": "block/turbofanOperate", "stream": false}]},
|
||||
"block.pressOperate": {"category": "block", "sounds": [{"name": "block/pressOperate", "stream": false}]},
|
||||
"block.broadcast1": {"category": "block", "sounds": [{"name": "block/broadcast1", "stream": false}]},
|
||||
"block.broadcast2": {"category": "block", "sounds": [{"name": "block/broadcast2", "stream": false}]},
|
||||
"block.broadcast3": {"category": "block", "sounds": [{"name": "block/broadcast3", "stream": false}]},
|
||||
|
||||
"item.techBleep": {"category": "player", "sounds": [{"name": "tool/techBleep", "stream": false}]},
|
||||
"item.techBoop": {"category": "player", "sounds": [{"name": "tool/techBoop", "stream": false}]},
|
||||
|
||||
BIN
assets/hbm/sounds/block/broadcast1.ogg
Normal file
BIN
assets/hbm/sounds/block/broadcast1.ogg
Normal file
Binary file not shown.
BIN
assets/hbm/sounds/block/broadcast2.ogg
Normal file
BIN
assets/hbm/sounds/block/broadcast2.ogg
Normal file
Binary file not shown.
BIN
assets/hbm/sounds/block/broadcast3.ogg
Normal file
BIN
assets/hbm/sounds/block/broadcast3.ogg
Normal file
Binary file not shown.
BIN
assets/hbm/textures/blocks/broadcaster_pc.png
Normal file
BIN
assets/hbm/textures/blocks/broadcaster_pc.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 386 B |
BIN
assets/hbm/textures/models/ModelBroadcaster.png
Normal file
BIN
assets/hbm/textures/models/ModelBroadcaster.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 795 B |
@ -142,6 +142,8 @@ public class ModBlocks {
|
||||
public static Block steel_beam;
|
||||
public static Block steel_scaffold;
|
||||
|
||||
public static Block broadcaster_pc;
|
||||
|
||||
public static Block mush;
|
||||
public static Block mush_block;
|
||||
public static Block mush_block_stem;
|
||||
@ -589,6 +591,8 @@ public class ModBlocks {
|
||||
steel_beam = new DecoBlock(Material.rock).setBlockName("steel_beam").setCreativeTab(MainRegistry.tabBlock).setHardness(15.0F).setResistance(15.0F).setBlockTextureName(RefStrings.MODID + ":steel_beam");
|
||||
steel_scaffold = new DecoBlock(Material.rock).setBlockName("steel_scaffold").setCreativeTab(MainRegistry.tabBlock).setHardness(15.0F).setResistance(15.0F).setBlockTextureName(RefStrings.MODID + ":steel_scaffold");
|
||||
|
||||
broadcaster_pc = new PinkCloudBroadcaster(Material.rock).setBlockName("broadcaster_pc").setCreativeTab(MainRegistry.tabNuke).setHardness(15.0F).setResistance(15.0F).setBlockTextureName(RefStrings.MODID + ":broadcaster_pc");
|
||||
|
||||
mush = new BlockMush(Material.plants).setBlockName("mush").setCreativeTab(MainRegistry.tabBlock).setLightLevel(0.5F).setStepSound(Block.soundTypeGrass).setBlockTextureName(RefStrings.MODID + ":mush");
|
||||
mush_block = new BlockMushHuge(Material.plants).setBlockName("mush_block").setLightLevel(1.0F).setStepSound(Block.soundTypeGrass).setHardness(0.2F).setBlockTextureName(RefStrings.MODID + ":mush_block_skin");
|
||||
mush_block_stem = new BlockMushHuge(Material.plants).setBlockName("mush_block_stem").setLightLevel(1.0F).setStepSound(Block.soundTypeGrass).setHardness(0.2F).setBlockTextureName(RefStrings.MODID + ":mush_block_stem");
|
||||
@ -1012,6 +1016,9 @@ public class ModBlocks {
|
||||
//Siren
|
||||
GameRegistry.registerBlock(machine_siren, machine_siren.getUnlocalizedName());
|
||||
|
||||
//This Thing
|
||||
GameRegistry.registerBlock(broadcaster_pc, broadcaster_pc.getUnlocalizedName());
|
||||
|
||||
//Silo Hatch
|
||||
GameRegistry.registerBlock(seal_frame, seal_frame.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(seal_controller, seal_controller.getUnlocalizedName());
|
||||
|
||||
114
com/hbm/blocks/machine/PinkCloudBroadcaster.java
Normal file
114
com/hbm/blocks/machine/PinkCloudBroadcaster.java
Normal file
@ -0,0 +1,114 @@
|
||||
package com.hbm.blocks.machine;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.tileentity.machine.TileEntityBroadcaster;
|
||||
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class PinkCloudBroadcaster extends BlockContainer {
|
||||
|
||||
public PinkCloudBroadcaster(Material p_i45386_1_) {
|
||||
super(p_i45386_1_);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
|
||||
return new TileEntityBroadcaster();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType(){
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) {
|
||||
int i = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
|
||||
|
||||
if(i == 0)
|
||||
{
|
||||
world.setBlockMetadataWithNotify(x, y, z, 3, 2);
|
||||
}
|
||||
if(i == 1)
|
||||
{
|
||||
world.setBlockMetadataWithNotify(x, y, z, 4, 2);
|
||||
}
|
||||
if(i == 2)
|
||||
{
|
||||
world.setBlockMetadataWithNotify(x, y, z, 2, 2);
|
||||
}
|
||||
if(i == 3)
|
||||
{
|
||||
world.setBlockMetadataWithNotify(x, y, z, 5, 2);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess p_149719_1_, int p_149719_2_, int p_149719_3_, int p_149719_4_)
|
||||
{
|
||||
int te = p_149719_1_.getBlockMetadata(p_149719_2_, p_149719_3_, p_149719_4_);
|
||||
float f = 0.0625F;
|
||||
|
||||
this.setBlockBounds(0.0F, 0.0F, 2*f, 1.0F, 1.0F, 14*f);
|
||||
switch(te)
|
||||
{
|
||||
case 4:
|
||||
this.setBlockBounds(4*f, 0.0F, 1*f, 12*f, 10*f, 15*f);
|
||||
break;
|
||||
case 2:
|
||||
this.setBlockBounds(1*f, 0.0F, 4*f, 15*f, 10*f, 12*f);
|
||||
break;
|
||||
case 5:
|
||||
this.setBlockBounds(4*f, 0.0F, 1*f, 12*f, 10*f, 15*f);
|
||||
break;
|
||||
case 3:
|
||||
this.setBlockBounds(1*f, 0.0F, 4*f, 15*f, 10*f, 12*f);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
|
||||
|
||||
int te = world.getBlockMetadata(x, y, z);
|
||||
float f = 0.0625F;
|
||||
|
||||
this.setBlockBounds(0.0F, 0.0F, 2*f, 1.0F, 1.0F, 14*f);
|
||||
switch(te)
|
||||
{
|
||||
case 4:
|
||||
this.setBlockBounds(4*f, 0.0F, 1*f, 12*f, 10*f, 15*f);
|
||||
break;
|
||||
case 2:
|
||||
this.setBlockBounds(1*f, 0.0F, 4*f, 15*f, 10*f, 12*f);
|
||||
break;
|
||||
case 5:
|
||||
this.setBlockBounds(4*f, 0.0F, 1*f, 12*f, 10*f, 15*f);
|
||||
break;
|
||||
case 3:
|
||||
this.setBlockBounds(1*f, 0.0F, 4*f, 15*f, 10*f, 12*f);
|
||||
break;
|
||||
}
|
||||
|
||||
return AxisAlignedBB.getBoundingBox(x + this.minX, y + this.minY, z + this.minZ, x + this.maxX, y + this.maxY, z + this.maxZ);
|
||||
}
|
||||
|
||||
}
|
||||
@ -73,7 +73,7 @@ public class EntityNukeExplosionMK4 extends Entity {
|
||||
|
||||
public static EntityNukeExplosionMK4 statFac(World world, int r, double x, double y, double z) {
|
||||
EntityNukeExplosionMK4 mk4 = new EntityNukeExplosionMK4(world);
|
||||
mk4.strength = r;
|
||||
mk4.strength = (int)(r / 1.5);
|
||||
mk4.count = (int)(4 * Math.PI * Math.pow(mk4.strength, 2) * 25);
|
||||
mk4.speed = (int)Math.ceil(100000 / mk4.strength);
|
||||
mk4.setPosition(x, y, z);
|
||||
|
||||
@ -149,9 +149,9 @@ public class ExplosionNukeRay {
|
||||
float z0 = (float) (posZ + (vec.zCoord * i));
|
||||
|
||||
if(!world.getBlock((int)x0, (int)y0, (int)z0).getMaterial().isLiquid())
|
||||
res -= Math.pow(world.getBlock((int)x0, (int)y0, (int)z0).getExplosionResistance(null), 1.25);
|
||||
res -= Math.pow(world.getBlock((int)x0, (int)y0, (int)z0).getExplosionResistance(null), 1.0);
|
||||
else
|
||||
res -= Math.pow(Blocks.air.getExplosionResistance(null), 1.25);
|
||||
res -= Math.pow(Blocks.air.getExplosionResistance(null), 1.0);
|
||||
|
||||
if(res > 0 && world.getBlock((int)x0, (int)y0, (int)z0) != Blocks.air) {
|
||||
lastPos = new FloatTriplet(x0, y0, z0);
|
||||
|
||||
@ -340,6 +340,18 @@ public class HbmWorldGen implements IWorldGenerator {
|
||||
|
||||
new Spaceship().generate(world, rand, x, y, z);
|
||||
}
|
||||
|
||||
if (rand.nextInt(MainRegistry.broadcaster) == 0) {
|
||||
int x = i + rand.nextInt(16);
|
||||
int z = j + rand.nextInt(16);
|
||||
int y = world.getHeightValue(x, z);
|
||||
|
||||
if(world.getBlock(x, y - 1, z).isBlockNormalCube())
|
||||
world.setBlock(x, y, z, ModBlocks.broadcaster_pc, rand.nextInt(4) + 2, 2);
|
||||
|
||||
if(MainRegistry.enableDebugMode)
|
||||
MainRegistry.logger.info("[Debug] Successfully spawned corrupted broadcaster at " + x + " " + y +" " + z);
|
||||
}
|
||||
}
|
||||
|
||||
if (rand.nextInt(15) == 0) {
|
||||
|
||||
@ -35,6 +35,7 @@ public class ModDamageSource extends DamageSource {
|
||||
public static DamageSource taint = (new DamageSource("taint")).setDamageIsAbsolute().setDamageBypassesArmor();
|
||||
public static DamageSource ams = (new DamageSource("ams")).setDamageIsAbsolute().setDamageBypassesArmor();
|
||||
public static DamageSource amsCore = (new DamageSource("amsCore")).setDamageIsAbsolute().setDamageBypassesArmor();
|
||||
public static DamageSource broadcast = (new DamageSource("broadcast")).setDamageIsAbsolute().setDamageBypassesArmor();
|
||||
|
||||
public ModDamageSource(String p_i1566_1_) {
|
||||
super(p_i1566_1_);
|
||||
|
||||
@ -270,6 +270,7 @@ public class ClientProxy extends ServerProxy
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityMissileExo.class, new RenderMissileThermo());
|
||||
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityDecoBlock.class, new RenderDecoBlock());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityBroadcaster.class, new RenderDecoBlock());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityDecoBlockAlt.class, new RenderDecoBlockAlt());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityDecoBlockAltG.class, new RenderDecoBlockAlt());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityDecoBlockAltW.class, new RenderDecoBlockAlt());
|
||||
|
||||
@ -202,6 +202,7 @@ import com.hbm.tileentity.deco.TileEntityYellowBarrel;
|
||||
import com.hbm.tileentity.machine.TileEntityAMSBase;
|
||||
import com.hbm.tileentity.machine.TileEntityAMSEmitter;
|
||||
import com.hbm.tileentity.machine.TileEntityAMSLimiter;
|
||||
import com.hbm.tileentity.machine.TileEntityBroadcaster;
|
||||
import com.hbm.tileentity.machine.TileEntityConverterHeRf;
|
||||
import com.hbm.tileentity.machine.TileEntityConverterRfHe;
|
||||
import com.hbm.tileentity.machine.TileEntityCoreAdvanced;
|
||||
@ -414,6 +415,7 @@ public class MainRegistry
|
||||
public static int factoryStructure = 1000;
|
||||
public static int dudStructure = 500;
|
||||
public static int spaceshipStructure = 1000;
|
||||
public static int broadcaster = 5000;
|
||||
public static int meteorStrikeChance = 20 * 60 * 90;
|
||||
public static int meteorShowerChance = 20 * 60 * 3;
|
||||
public static int meteorShowerDuration = 6000;
|
||||
@ -574,6 +576,7 @@ public class MainRegistry
|
||||
GameRegistry.registerTileEntity(TileEntityMachineTransformer.class, "tileentity_transformer");
|
||||
GameRegistry.registerTileEntity(TileEntityTurretCWIS.class, "tileentity_turret_cwis");
|
||||
GameRegistry.registerTileEntity(TileEntityMachineRadar.class, "tileentity_radar");
|
||||
GameRegistry.registerTileEntity(TileEntityBroadcaster.class, "tileentity_pink_cloud_broadcaster");
|
||||
|
||||
EntityRegistry.registerModEntity(EntityRocket.class, "entity_rocket", 0, this, 250, 1, true);
|
||||
EntityRegistry.registerModEntity(EntityNukeExplosion.class, "entity_nuke_explosion", 1, this, 250, 1, true);
|
||||
@ -1314,6 +1317,9 @@ public class MainRegistry
|
||||
Property propSpaceship = config.get(Configuration.CATEGORY_GENERAL, "4.11_spaceshipSpawn", 1000);
|
||||
propSpaceship.comment = "Spawn spaceship on every nTH chunk";
|
||||
spaceshipStructure = propSpaceship.getInt();
|
||||
Property propBroadcaster = config.get(Configuration.CATEGORY_GENERAL, "4.12_broadcasterSpawn", 5000);
|
||||
propBroadcaster.comment = "Spawn spaceship on every nTH chunk";
|
||||
broadcaster = propBroadcaster.getInt();
|
||||
|
||||
Property propMeteorStrikeChance = config.get(Configuration.CATEGORY_GENERAL, "5.00_meteorStrikeChance", 50000);
|
||||
propMeteorStrikeChance.comment = "The probability of a meteor spawning (an average of once every nTH ticks)";
|
||||
|
||||
@ -1,10 +1,12 @@
|
||||
package com.hbm.packet;
|
||||
|
||||
import com.hbm.sound.SoundLoopAssembler;
|
||||
import com.hbm.sound.SoundLoopBroadcaster;
|
||||
import com.hbm.sound.SoundLoopChemplant;
|
||||
import com.hbm.sound.SoundLoopIGen;
|
||||
import com.hbm.sound.SoundLoopMiner;
|
||||
import com.hbm.sound.SoundLoopTurbofan;
|
||||
import com.hbm.tileentity.machine.TileEntityBroadcaster;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineAssembler;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineChemplant;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineIGenerator;
|
||||
@ -120,6 +122,20 @@ public class LoopedSoundPacket implements IMessage {
|
||||
if(flag && te.getWorldObj().isRemote && ((TileEntityMachineTurbofan)te).isRunning)
|
||||
Minecraft.getMinecraft().getSoundHandler().playSound(new SoundLoopTurbofan(new ResourceLocation("hbm:block.turbofanOperate"), te));
|
||||
}
|
||||
|
||||
if (te != null && te instanceof TileEntityBroadcaster) {
|
||||
|
||||
boolean flag = true;
|
||||
for(int i = 0; i < SoundLoopBroadcaster.list.size(); i++) {
|
||||
if(SoundLoopBroadcaster.list.get(i).getTE() == te && !SoundLoopBroadcaster.list.get(i).isDonePlaying())
|
||||
flag = false;
|
||||
}
|
||||
|
||||
int j = te.xCoord + te.zCoord + te.yCoord;
|
||||
|
||||
if(flag && te.getWorldObj().isRemote)
|
||||
Minecraft.getMinecraft().getSoundHandler().playSound(new SoundLoopBroadcaster(new ResourceLocation("hbm:block.broadcast" + (j % 3 + 1)), te));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
76
com/hbm/render/model/ModelBroadcaster.java
Normal file
76
com/hbm/render/model/ModelBroadcaster.java
Normal file
@ -0,0 +1,76 @@
|
||||
// Date: 04.03.2018 11:54:19
|
||||
// Template version 1.1
|
||||
// Java generated by Techne
|
||||
// Keep in mind that you still need to fill in some blanks
|
||||
// - ZeuX
|
||||
|
||||
package com.hbm.render.model;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
public class ModelBroadcaster extends ModelBase {
|
||||
// fields
|
||||
ModelRenderer Shape1;
|
||||
ModelRenderer Shape2;
|
||||
ModelRenderer Shape3;
|
||||
ModelRenderer Shape4;
|
||||
|
||||
public ModelBroadcaster() {
|
||||
textureWidth = 64;
|
||||
textureHeight = 32;
|
||||
|
||||
Shape1 = new ModelRenderer(this, 0, 0);
|
||||
Shape1.addBox(0F, 0F, 0F, 14, 10, 8);
|
||||
Shape1.setRotationPoint(-7F, 14F, -4F);
|
||||
Shape1.setTextureSize(64, 32);
|
||||
Shape1.mirror = true;
|
||||
setRotation(Shape1, 0F, 0F, 0F);
|
||||
Shape2 = new ModelRenderer(this, 4, 21);
|
||||
Shape2.addBox(0F, 0F, 0F, 2, 3, 2);
|
||||
Shape2.setRotationPoint(-5F, 11F, -1F);
|
||||
Shape2.setTextureSize(64, 32);
|
||||
Shape2.mirror = true;
|
||||
setRotation(Shape2, 0F, 0F, 0F);
|
||||
Shape3 = new ModelRenderer(this, 0, 18);
|
||||
Shape3.addBox(0F, 0F, 0F, 1, 11, 1);
|
||||
Shape3.setRotationPoint(-4.5F, 0F, -0.5F);
|
||||
Shape3.setTextureSize(64, 32);
|
||||
Shape3.mirror = true;
|
||||
setRotation(Shape3, 0F, 0F, 0F);
|
||||
Shape4 = new ModelRenderer(this, 4, 18);
|
||||
Shape4.addBox(0F, 0F, 0F, 3, 2, 1);
|
||||
Shape4.setRotationPoint(2F, 12F, -0.5F);
|
||||
Shape4.setTextureSize(64, 32);
|
||||
Shape4.mirror = true;
|
||||
setRotation(Shape4, 0F, 0F, 0F);
|
||||
}
|
||||
|
||||
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
|
||||
super.render(entity, f, f1, f2, f3, f4, f5);
|
||||
setRotationAngles(f, f1, f2, f3, f4, f5, entity);
|
||||
Shape1.render(f5);
|
||||
Shape2.render(f5);
|
||||
Shape3.render(f5);
|
||||
Shape4.render(f5);
|
||||
}
|
||||
|
||||
public void renderModel(float f) {
|
||||
Shape1.render(f);
|
||||
Shape2.render(f);
|
||||
Shape3.render(f);
|
||||
Shape4.render(f);
|
||||
}
|
||||
|
||||
private void setRotation(ModelRenderer model, float x, float y, float z) {
|
||||
model.rotateAngleX = x;
|
||||
model.rotateAngleY = y;
|
||||
model.rotateAngleZ = z;
|
||||
}
|
||||
|
||||
public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) {
|
||||
super.setRotationAngles(f, f1, f2, f3, f4, f5, entity);
|
||||
}
|
||||
|
||||
}
|
||||
@ -5,6 +5,7 @@ import org.lwjgl.opengl.GL11;
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.main.ResourceManager;
|
||||
import com.hbm.render.model.ModelBroadcaster;
|
||||
import com.hbm.render.model.ModelSteelBeam;
|
||||
import com.hbm.render.model.ModelSteelCorner;
|
||||
import com.hbm.render.model.ModelSteelRoof;
|
||||
@ -22,12 +23,14 @@ public class RenderDecoBlock extends TileEntitySpecialRenderer {
|
||||
private static final ResourceLocation texture3 = new ResourceLocation(RefStrings.MODID + ":" + "textures/models/SteelRoof.png");
|
||||
private static final ResourceLocation texture4 = new ResourceLocation(RefStrings.MODID + ":" + "textures/models/SteelBeam.png");
|
||||
private static final ResourceLocation texture5 = new ResourceLocation(RefStrings.MODID + ":" + "textures/models/SteelScaffold.png");
|
||||
private static final ResourceLocation texture6 = new ResourceLocation(RefStrings.MODID + ":" + "textures/models/ModelBroadcaster.png");
|
||||
|
||||
private ModelSteelWall model1;
|
||||
private ModelSteelCorner model2;
|
||||
private ModelSteelRoof model3;
|
||||
private ModelSteelBeam model4;
|
||||
private ModelSteelScaffold model5;
|
||||
private ModelBroadcaster model6;
|
||||
|
||||
public RenderDecoBlock() {
|
||||
this.model1 = new ModelSteelWall();
|
||||
@ -35,6 +38,7 @@ public class RenderDecoBlock extends TileEntitySpecialRenderer {
|
||||
this.model3 = new ModelSteelRoof();
|
||||
this.model4 = new ModelSteelBeam();
|
||||
this.model5 = new ModelSteelScaffold();
|
||||
this.model6 = new ModelBroadcaster();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -96,6 +100,21 @@ public class RenderDecoBlock extends TileEntitySpecialRenderer {
|
||||
GL11.glRotatef(0, 0F, 1F, 0F); break;
|
||||
}
|
||||
}
|
||||
if(tileentity.getWorldObj().getBlock(tileentity.xCoord, tileentity.yCoord, tileentity.zCoord) == ModBlocks.broadcaster_pc)
|
||||
{
|
||||
this.bindTexture(texture6);
|
||||
switch(tileentity.getBlockMetadata())
|
||||
{
|
||||
case 4:
|
||||
GL11.glRotatef(90, 0F, 1F, 0F); break;
|
||||
case 2:
|
||||
GL11.glRotatef(180, 0F, 1F, 0F); break;
|
||||
case 5:
|
||||
GL11.glRotatef(270, 0F, 1F, 0F); break;
|
||||
case 3:
|
||||
GL11.glRotatef(0, 0F, 1F, 0F); break;
|
||||
}
|
||||
}
|
||||
|
||||
GL11.glPushMatrix();
|
||||
if(tileentity.getWorldObj().getBlock(tileentity.xCoord, tileentity.yCoord, tileentity.zCoord) == ModBlocks.steel_wall)
|
||||
@ -108,6 +127,8 @@ public class RenderDecoBlock extends TileEntitySpecialRenderer {
|
||||
this.model4.renderModel(0.0625F);
|
||||
if(tileentity.getWorldObj().getBlock(tileentity.xCoord, tileentity.yCoord, tileentity.zCoord) == ModBlocks.steel_scaffold)
|
||||
this.model5.renderModel(0.0625F);
|
||||
if(tileentity.getWorldObj().getBlock(tileentity.xCoord, tileentity.yCoord, tileentity.zCoord) == ModBlocks.broadcaster_pc)
|
||||
this.model6.renderModel(0.0625F);
|
||||
GL11.glPopMatrix();
|
||||
|
||||
if(tileentity.getWorldObj().getBlock(tileentity.xCoord, tileentity.yCoord, tileentity.zCoord) == ModBlocks.boxcar) {
|
||||
|
||||
50
com/hbm/sound/SoundLoopBroadcaster.java
Normal file
50
com/hbm/sound/SoundLoopBroadcaster.java
Normal file
@ -0,0 +1,50 @@
|
||||
package com.hbm.sound;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.tileentity.machine.TileEntityBroadcaster;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineChemplant;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineMiningDrill;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.audio.ISound;
|
||||
import net.minecraft.client.entity.EntityClientPlayerMP;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class SoundLoopBroadcaster extends SoundLoopMachine {
|
||||
|
||||
public static List<SoundLoopBroadcaster> list = new ArrayList<SoundLoopBroadcaster>();
|
||||
public float intendedVolume = 25.0F;
|
||||
|
||||
public SoundLoopBroadcaster(ResourceLocation path, TileEntity te) {
|
||||
super(path, te);
|
||||
list.add(this);
|
||||
this.field_147666_i = ISound.AttenuationType.NONE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
super.update();
|
||||
|
||||
EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer;
|
||||
float f = 0;
|
||||
|
||||
if(player != null) {
|
||||
f = (float)Math.sqrt(Math.pow(xPosF - player.posX, 2) + Math.pow(yPosF - player.posY, 2) + Math.pow(zPosF - player.posZ, 2));
|
||||
volume = func(f, intendedVolume);
|
||||
} else {
|
||||
volume = intendedVolume;
|
||||
}
|
||||
}
|
||||
|
||||
public TileEntity getTE() {
|
||||
return te;
|
||||
}
|
||||
|
||||
public float func(float f, float v) {
|
||||
return (f / v) * -2 + 2;
|
||||
}
|
||||
|
||||
}
|
||||
56
com/hbm/tileentity/machine/TileEntityBroadcaster.java
Normal file
56
com/hbm/tileentity/machine/TileEntityBroadcaster.java
Normal file
@ -0,0 +1,56 @@
|
||||
package com.hbm.tileentity.machine;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.lib.ModDamageSource;
|
||||
import com.hbm.packet.LoopedSoundPacket;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
|
||||
public class TileEntityBroadcaster extends TileEntity {
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
List<Entity> list = worldObj.getEntitiesWithinAABBExcludingEntity(null, AxisAlignedBB.getBoundingBox(xCoord + 0.5 - 25, yCoord + 0.5 - 25, zCoord + 0.5 - 25, xCoord + 0.5 + 25, yCoord + 0.5 + 25, zCoord + 0.5 + 25));
|
||||
|
||||
for(int i = 0; i < list.size(); i++) {
|
||||
if(list.get(i) instanceof EntityLivingBase) {
|
||||
EntityLivingBase e = (EntityLivingBase)list.get(i);
|
||||
double d = Math.sqrt(Math.pow(e.posX - (xCoord + 0.5), 2) + Math.pow(e.posY - (yCoord + 0.5), 2) + Math.pow(e.posZ - (zCoord + 0.5), 2));
|
||||
|
||||
if(d <= 25) {
|
||||
double t = (25 - d) / 25 * 10;
|
||||
e.attackEntityFrom(ModDamageSource.broadcast, (float) t);
|
||||
if(e.getActivePotionEffect(Potion.confusion) == null || e.getActivePotionEffect(Potion.confusion).getDuration() < 100)
|
||||
e.addPotionEffect(new PotionEffect(Potion.confusion.id, 300, 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
PacketDispatcher.wrapper.sendToAll(new LoopedSoundPacket(xCoord, yCoord, zCoord));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getRenderBoundingBox() {
|
||||
return TileEntity.INFINITE_EXTENT_AABB;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public double getMaxRenderDistanceSquared()
|
||||
{
|
||||
return 65536.0D;
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user