mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-02-24 15:00:48 +00:00
tritium lamps now have a shoddy light beam implementation too
more cargo cult behavior
This commit is contained in:
parent
d9a6788299
commit
a6ccd25119
11
changelog
11
changelog
@ -9,6 +9,15 @@
|
||||
* Using desulfurized oil skips the (rather destructive) desulfurization process of the standard refinery, yielding higher-quality oils
|
||||
* Hydrotreating also allows cracked diesel variants to turn into their normal counterparts
|
||||
* Can convert coal oil directly into coal gasoline
|
||||
* Rural house
|
||||
* A new structure of an old brick house
|
||||
* Industrial lighting
|
||||
* Three new lamps that project out a beam of light for more coverage
|
||||
* Cage lamps are made from tungsten filaments and project light by 2 additional blocks
|
||||
* Fluorescent lights are made from mercury and project light 8 blocks, they also connect with each other to form light strips
|
||||
* Halogen floodlights are made with bromine and cast a light beam 32 blocks long
|
||||
* Lights are on by default and can be toggled with redstone
|
||||
* Tritium lamps have also been retrofitted with longer range lighting, casting beams in all cardinal directions for 8 blocks
|
||||
|
||||
## Changed
|
||||
* Deco bocks now drop all of the time, but they drop themselves instead of ingots
|
||||
@ -37,6 +46,7 @@
|
||||
* Doomsday missiles are no longer laggy cluster missiles, instead they are now near-identical to thermonuclear missiles but with an added fallout radius of 100#
|
||||
* Fallout rain now uses the same variable length code that the MK5 uses for optimal tick utilization, making it a lot faster
|
||||
* Lighter sellafite variants should no longer replace darker ones in overlapping craters, making bombed-out landscapes look more natural
|
||||
* Fallout's range-based effects now have a more natural gradient instead of creating smooth rings
|
||||
|
||||
## Fixed
|
||||
* Fixed dupe caused by shift-clicking ashes out of the bricked furnace
|
||||
@ -51,3 +61,4 @@
|
||||
* Fixed several chemistry templates missing names
|
||||
* Fixed rampant mode random scout spawns being able to appear inside blocks
|
||||
* Fixed turret rotation sometimes desyncing when out of range, this is especially noticeable with slow-moving arty
|
||||
* Fixed research reactor OC integration allowing the control rods to be set out of bounds
|
||||
@ -17,5 +17,5 @@ credits=HbMinecraft, rodolphito (explosion algorithms), grangerave (explosion al
|
||||
\ JamesH2 (blood mechanics, nitric acid, particle emitter), sdddddf80 (recipe configs, chinese localization,\
|
||||
\ custom machine holograms, I18n improvements), SuperCraftAlex (tooltips) LePeep (coilgun model, BDCL QC),\
|
||||
\ 70k (textures, glyphid AI, strand caster), Maksymisio (polish localization) Ice-Arrow (research reactor tweaks),\
|
||||
\ 245tt (anvil GUI improvements), MellowArpeggiation (new animation system, turbine sounds, sound fixes),\
|
||||
\ FOlkvangrField (custom machine parts)
|
||||
\ 245tt (anvil GUI improvements), MellowArpeggiation (new animation system, turbine sounds, sound fixes,\
|
||||
\ industrial lights), FOlkvangrField (custom machine parts)
|
||||
|
||||
6
src/main/java/com/hbm/blocks/ISpotlight.java
Normal file
6
src/main/java/com/hbm/blocks/ISpotlight.java
Normal file
@ -0,0 +1,6 @@
|
||||
package com.hbm.blocks;
|
||||
|
||||
public interface ISpotlight {
|
||||
|
||||
public int getBeamLength();
|
||||
}
|
||||
@ -1557,10 +1557,10 @@ public class ModBlocks {
|
||||
reinforced_laminate = new BlockNTMGlassCT(1, RefStrings.MODID + ":reinforced_laminate", Material.rock, true).setBlockName("reinforced_laminate").setCreativeTab(MainRegistry.blockTab).setLightOpacity(0).setHardness(15.0F).setResistance(300.0F);
|
||||
reinforced_laminate_pane = new BlockNTMGlassPane(1, RefStrings.MODID + ":reinforced_laminate_pane", RefStrings.MODID + ":reinforced_laminate_pane_edge", Material.rock, true).setBlockName("reinforced_laminate_pane").setCreativeTab(MainRegistry.blockTab).setLightOpacity(1).setHardness(15.0F).setResistance(300.0F);
|
||||
|
||||
lamp_tritium_green_off = new ReinforcedLamp(Material.redstoneLight, false).setBlockName("lamp_tritium_green_off").setStepSound(Block.soundTypeGlass).setCreativeTab(MainRegistry.blockTab).setHardness(3.0F).setBlockTextureName(RefStrings.MODID + ":lamp_tritium_green_off");
|
||||
lamp_tritium_green_on = new ReinforcedLamp(Material.redstoneLight, true).setBlockName("lamp_tritium_green_on").setStepSound(Block.soundTypeGlass).setHardness(3.0F).setBlockTextureName(RefStrings.MODID + ":lamp_tritium_green_on");
|
||||
lamp_tritium_blue_off = new ReinforcedLamp(Material.redstoneLight, false).setBlockName("lamp_tritium_blue_off").setStepSound(Block.soundTypeGlass).setCreativeTab(MainRegistry.blockTab).setHardness(3.0F).setBlockTextureName(RefStrings.MODID + ":lamp_tritium_blue_off");
|
||||
lamp_tritium_blue_on = new ReinforcedLamp(Material.redstoneLight, true).setBlockName("lamp_tritium_blue_on").setStepSound(Block.soundTypeGlass).setHardness(3.0F).setBlockTextureName(RefStrings.MODID + ":lamp_tritium_blue_on");
|
||||
lamp_tritium_green_off = new TritiumLamp(Material.redstoneLight, false).setBlockName("lamp_tritium_green_off").setStepSound(Block.soundTypeGlass).setCreativeTab(MainRegistry.blockTab).setHardness(3.0F).setBlockTextureName(RefStrings.MODID + ":lamp_tritium_green_off");
|
||||
lamp_tritium_green_on = new TritiumLamp(Material.redstoneLight, true).setBlockName("lamp_tritium_green_on").setStepSound(Block.soundTypeGlass).setHardness(3.0F).setBlockTextureName(RefStrings.MODID + ":lamp_tritium_green_on");
|
||||
lamp_tritium_blue_off = new TritiumLamp(Material.redstoneLight, false).setBlockName("lamp_tritium_blue_off").setStepSound(Block.soundTypeGlass).setCreativeTab(MainRegistry.blockTab).setHardness(3.0F).setBlockTextureName(RefStrings.MODID + ":lamp_tritium_blue_off");
|
||||
lamp_tritium_blue_on = new TritiumLamp(Material.redstoneLight, true).setBlockName("lamp_tritium_blue_on").setStepSound(Block.soundTypeGlass).setHardness(3.0F).setBlockTextureName(RefStrings.MODID + ":lamp_tritium_blue_on");
|
||||
|
||||
lamp_uv_off = new UVLamp(false).setBlockName("lamp_uv_off").setCreativeTab(MainRegistry.blockTab);
|
||||
lamp_uv_on = new UVLamp(true).setBlockName("lamp_uv_on").setCreativeTab(null);
|
||||
|
||||
@ -78,26 +78,12 @@ public class ReinforcedLamp extends Block {
|
||||
}
|
||||
|
||||
protected Block getOff() {
|
||||
|
||||
if(this == ModBlocks.reinforced_lamp_on)
|
||||
return ModBlocks.reinforced_lamp_off;
|
||||
if(this == ModBlocks.lamp_tritium_green_on)
|
||||
return ModBlocks.lamp_tritium_green_off;
|
||||
if(this == ModBlocks.lamp_tritium_blue_on)
|
||||
return ModBlocks.lamp_tritium_blue_off;
|
||||
|
||||
if(this == ModBlocks.reinforced_lamp_on) return ModBlocks.reinforced_lamp_off;
|
||||
return this;
|
||||
}
|
||||
|
||||
protected Block getOn() {
|
||||
|
||||
if(this == ModBlocks.reinforced_lamp_off)
|
||||
return ModBlocks.reinforced_lamp_on;
|
||||
if(this == ModBlocks.lamp_tritium_green_off)
|
||||
return ModBlocks.lamp_tritium_green_on;
|
||||
if(this == ModBlocks.lamp_tritium_blue_off)
|
||||
return ModBlocks.lamp_tritium_blue_on;
|
||||
|
||||
if(this == ModBlocks.reinforced_lamp_off) return ModBlocks.reinforced_lamp_on;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
117
src/main/java/com/hbm/blocks/generic/TritiumLamp.java
Normal file
117
src/main/java/com/hbm/blocks/generic/TritiumLamp.java
Normal file
@ -0,0 +1,117 @@
|
||||
package com.hbm.blocks.generic;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.blocks.ISpotlight;
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.blocks.machine.Spotlight;
|
||||
|
||||
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.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TritiumLamp extends Block implements ISpotlight {
|
||||
|
||||
private final boolean isOn;
|
||||
|
||||
public TritiumLamp(Material mat, boolean isOn) {
|
||||
super(mat);
|
||||
this.isOn = isOn;
|
||||
|
||||
if(isOn) {
|
||||
this.setLightLevel(1.0F);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockAdded(World world, int x, int y, int z) {
|
||||
|
||||
if(!world.isRemote) {
|
||||
|
||||
if(this.isOn && !world.isBlockIndirectlyGettingPowered(x, y, z)) {
|
||||
world.scheduleBlockUpdate(x, y, z, this, 4);
|
||||
|
||||
} else if(!this.isOn && world.isBlockIndirectlyGettingPowered(x, y, z)) {
|
||||
world.setBlock(x, y, z, getOn(), 0, 2);
|
||||
}
|
||||
|
||||
updateBeam(world, x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange(World world, int x, int y, int z, Block b) {
|
||||
|
||||
if(!world.isRemote) {
|
||||
|
||||
if(this.isOn && !world.isBlockIndirectlyGettingPowered(x, y, z)) {
|
||||
world.scheduleBlockUpdate(x, y, z, this, 4);
|
||||
|
||||
} else if(!this.isOn && world.isBlockIndirectlyGettingPowered(x, y, z)) {
|
||||
world.setBlock(x, y, z, getOn(), 0, 2);
|
||||
}
|
||||
|
||||
updateBeam(world, x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTick(World world, int x, int y, int z, Random p_149674_5_) {
|
||||
|
||||
if(!world.isRemote && this.isOn && !world.isBlockIndirectlyGettingPowered(x, y, z)) {
|
||||
world.setBlock(x, y, z, getOff(), 0, 2);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int metadata) {
|
||||
super.breakBlock(world, x, y, z, block, metadata);
|
||||
if(world.isRemote) return;
|
||||
|
||||
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) Spotlight.unpropagateBeam(world, x, y, z, dir);
|
||||
}
|
||||
|
||||
private void updateBeam(World world, int x, int y, int z) {
|
||||
if(!isOn) return;
|
||||
|
||||
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) Spotlight.propagateBeam(world, x, y, z, dir, getBeamLength());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int i, Random r, int j) {
|
||||
return Item.getItemFromBlock(getOff());
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Item getItem(World world, int x, int y, int z) {
|
||||
return Item.getItemFromBlock(getOff());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ItemStack createStackedBlock(int e) {
|
||||
return new ItemStack(getOff());
|
||||
}
|
||||
|
||||
protected Block getOff() {
|
||||
if(this == ModBlocks.lamp_tritium_green_on) return ModBlocks.lamp_tritium_green_off;
|
||||
if(this == ModBlocks.lamp_tritium_blue_on) return ModBlocks.lamp_tritium_blue_off;
|
||||
return this;
|
||||
}
|
||||
|
||||
protected Block getOn() {
|
||||
if(this == ModBlocks.lamp_tritium_green_off) return ModBlocks.lamp_tritium_green_on;
|
||||
if(this == ModBlocks.lamp_tritium_blue_off) return ModBlocks.lamp_tritium_blue_on;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBeamLength() {
|
||||
return 8;
|
||||
}
|
||||
}
|
||||
@ -5,6 +5,7 @@ import com.hbm.blocks.ModBlocks;
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.blocks.BlockEnums.LightType;
|
||||
import com.hbm.blocks.ISpotlight;
|
||||
import com.hbm.main.ResourceManager;
|
||||
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
@ -21,7 +22,7 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.model.obj.WavefrontObject;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class Spotlight extends Block {
|
||||
public class Spotlight extends Block implements ISpotlight {
|
||||
|
||||
// I'd be extending the ReinforcedLamp class if it wasn't for the inverted behaviour of these specific lights
|
||||
// I want these blocks to be eminently useful, so removing the need for redstone by default is desired,
|
||||
@ -91,13 +92,10 @@ public class Spotlight extends Block {
|
||||
float[] bounds = getBounds();
|
||||
switch(dir) {
|
||||
case EAST:
|
||||
case WEST:
|
||||
return new float[] { bounds[2], bounds[1], bounds[0] };
|
||||
case WEST: return new float[] { bounds[2], bounds[1], bounds[0] };
|
||||
case UP:
|
||||
case DOWN:
|
||||
return new float[] { bounds[1], bounds[2], bounds[0] };
|
||||
default:
|
||||
return bounds;
|
||||
case DOWN: return new float[] { bounds[1], bounds[2], bounds[0] };
|
||||
default: return bounds;
|
||||
}
|
||||
}
|
||||
|
||||
@ -118,9 +116,7 @@ public class Spotlight extends Block {
|
||||
@Override
|
||||
public void onBlockAdded(World world, int x, int y, int z) {
|
||||
if(world.isRemote) return;
|
||||
|
||||
if(updatePower(world, x, y, z)) return;
|
||||
|
||||
updateBeam(world, x, y, z);
|
||||
}
|
||||
|
||||
@ -236,20 +232,23 @@ public class Spotlight extends Block {
|
||||
// Recursively add beam blocks, updating any that already exist with new incoming light directions
|
||||
public static void propagateBeam(World world, int x, int y, int z, ForgeDirection dir, int distance) {
|
||||
distance--;
|
||||
if (distance <= 0) return;
|
||||
if(distance <= 0)
|
||||
return;
|
||||
|
||||
x += dir.offsetX;
|
||||
y += dir.offsetY;
|
||||
z += dir.offsetZ;
|
||||
|
||||
Block block = world.getBlock(x, y, z);
|
||||
if (!block.isAir(world, x, y, z)) return;
|
||||
if(!block.isAir(world, x, y, z))
|
||||
return;
|
||||
|
||||
if(!(block instanceof SpotlightBeam)) {
|
||||
world.setBlock(x, y, z, ModBlocks.spotlight_beam);
|
||||
}
|
||||
|
||||
// If we encounter an existing beam, add a new INCOMING direction to the metadata
|
||||
// If we encounter an existing beam, add a new INCOMING direction to the
|
||||
// metadata
|
||||
SpotlightBeam.setDirection(world, x, y, z, dir, true);
|
||||
|
||||
propagateBeam(world, x, y, z, dir, distance);
|
||||
@ -262,7 +261,8 @@ public class Spotlight extends Block {
|
||||
z += dir.offsetZ;
|
||||
|
||||
Block block = world.getBlock(x, y, z);
|
||||
if (!(block instanceof SpotlightBeam)) return;
|
||||
if(!(block instanceof SpotlightBeam))
|
||||
return;
|
||||
|
||||
// Remove the metadata associated with this direction
|
||||
// If all directions are set to zero, delete the beam
|
||||
@ -280,9 +280,9 @@ public class Spotlight extends Block {
|
||||
z -= dir.offsetZ;
|
||||
|
||||
Block block = world.getBlock(x, y, z);
|
||||
if (block instanceof Spotlight) {
|
||||
Spotlight spot = (Spotlight) block;
|
||||
propagateBeam(world, x, y, z, dir, spot.beamLength);
|
||||
if(block instanceof ISpotlight) {
|
||||
ISpotlight spot = (ISpotlight) block;
|
||||
propagateBeam(world, x, y, z, dir, spot.getBeamLength());
|
||||
} else if(!(block instanceof SpotlightBeam)) {
|
||||
return;
|
||||
}
|
||||
@ -312,4 +312,8 @@ public class Spotlight extends Block {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBeamLength() {
|
||||
return this.beamLength;
|
||||
}
|
||||
}
|
||||
|
||||
@ -111,7 +111,6 @@ public class SpotlightBeam extends BlockContainer {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
@ -131,5 +130,4 @@ public class SpotlightBeam extends BlockContainer {
|
||||
public int getRenderType() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user