1
0
Fork 0

add colored lighting

This commit is contained in:
Sen 2025-08-30 14:10:58 +02:00
parent 16d20fb31d
commit d4c7c5bbea
Signed by: sen
GPG key ID: 3AC50A6F47D1B722
23 changed files with 234 additions and 323 deletions

View file

@ -386,13 +386,8 @@ public class Block {
return this;
}
public final Block setLight(float level) {
this.light = (int)(15.0F * level);
return this;
}
public final Block setLight(int level) {
this.light = level;
public final Block setLight(int color) {
this.light = color;
return this;
}

View file

@ -25,7 +25,7 @@ public class BlockFloorPortal extends Block
public BlockFloorPortal(Material materialIn)
{
super(materialIn);
this.setLight(1.0F);
this.setLight(0x7f00ff);
}
// /**

View file

@ -20,7 +20,7 @@ public class BlockMetalBlock extends Block {
super(Material.SOLID);
this.metal = metal;
this.setSound(SoundType.STONE);
this.setLight(metal.radioactivity > 0.0F ? 0.25F : 0.0F);
this.setLight(metal.radioactivity > 0.0F ? 0x003f00 : 0x000000);
this.setRadiation(metal.radioactivity * 2.0f);
this.setTab(CheatTab.GEMS);
}

View file

@ -67,7 +67,7 @@ public class BlockBlueShroom extends BlockBush
protected boolean canPlaceBlockOn(Block ground)
{
return ground.isFullBlock();
return ground.isFullBlock() || ground.isNonBlock();
}
public boolean canBlockStay(World worldIn, BlockPos pos, State state)

View file

@ -70,7 +70,7 @@ public class BlockMushroom extends BlockBush implements IGrowable
*/
protected boolean canPlaceBlockOn(Block ground)
{
return ground.isFullBlock();
return ground.isFullBlock() || ground.isNonBlock();
}
public boolean canBlockStay(World worldIn, BlockPos pos, State state)

View file

@ -15,7 +15,7 @@ public class BlockMetalOre extends BlockOre {
public BlockMetalOre(MetalType metal) {
this.metal = metal;
this.setSound(SoundType.STONE);
this.setLight(metal.radioactivity > 0.0F ? 0.25F : 0.0F);
this.setLight(metal.radioactivity > 0.0F ? 0x003f00 : 0x000000);
this.setRadiation(metal.radioactivity * 0.5f);
}

View file

@ -18,7 +18,7 @@ public class BlockActiveDisplay extends BlockDisplay implements ITileEntityProvi
public BlockActiveDisplay(BlockInactiveDisplay inactive) {
super(inactive.getDensity());
this.setLight(1.0f);
this.setLight(0xafafff);
this.inactive = inactive;
inactive.setActive(this);
}

View file

@ -37,7 +37,7 @@ public class BlockFurnace extends BlockMachine {
this.fuelEfficiency = fuelEfficiency;
this.setHardness(3.5F).setSound(SoundType.STONE);
if(this.isBurning)
this.setLight(0.875F);
this.setLight(0xffffaf);
}
public BlockFurnace(int burnTime, int fuelEfficiency) {

View file

@ -18,7 +18,7 @@ public class BlockToggleableLight extends Block {
super(Material.LOOSE);
this.isOn = isOn;
if(isOn)
this.setLight(1.0F);
this.setLight(0xffffcf);
}
public void toggle(World worldIn, BlockPos pos) {

View file

@ -118,10 +118,10 @@ public abstract class BlockRegistry {
private static void registerFluid(String name, String display, LiquidType type, int light, int rate,
float radiation, Object still, Object flowing) {
BlockDynamicLiquid dy = (BlockDynamicLiquid)(new BlockDynamicLiquid(type.material, rate, flowing)).setHardness(100.0F)
.setOpacity(3).setLight((float)light / 15.0f).setDisplay(display)
.setOpacity(3).setLight(light).setDisplay(display)
.setRadiation(radiation);
BlockStaticLiquid st = (BlockStaticLiquid)(new BlockStaticLiquid(type.material, rate, still, dy)).setHardness(100.0F)
.setOpacity(3).setLight((float)light / 15.0f).setDisplay(display)
.setOpacity(3).setLight(light).setDisplay(display)
.setRadiation(radiation);
register("flowing_" + name, dy);
register(name, st);
@ -170,7 +170,7 @@ public abstract class BlockRegistry {
register("ice", (new BlockIce()).setHardness(0.5F).setOpacity(3).setSound(SoundType.GLASS).setDisplay("Eis").setMiningTool(Equipment.PICKAXE, 0));
register("packed_ice", (new BlockPackedIce()).setHardness(0.5F).setSound(SoundType.GLASS).setDisplay("Packeis").setMiningTool(Equipment.PICKAXE, 0));
register("soul_sand", (new BlockSoulSand()).setHardness(0.5F).setSound(SoundType.SAND).setDisplay("Seelensand").setMiningTool(Equipment.SHOVEL));
register("glowstone", (new BlockGlowstone(Material.TRANSLUCENT)).setHardness(0.3F).setSound(SoundType.GLASS).setLight(1.0F)
register("glowstone", (new BlockGlowstone(Material.TRANSLUCENT)).setHardness(0.3F).setSound(SoundType.GLASS).setLight(0xffff3f)
.setDisplay("Glowstone"));
Block blackened_stone = register("blackened_stone", (new BlockBlackenedStone()).setHardness(1.5F).setResistance(10.0F).setSound(SoundType.STONE).setDisplay("Schwarzstein"));
Block blackened_cobble = register("blackened_cobble", (new BlockNonBlock(Material.SOLID)).setHardness(2.0F).setResistance(10.0F).setSound(SoundType.STONE)
@ -178,9 +178,9 @@ public abstract class BlockRegistry {
registerFluid("water", "Wasser", LiquidType.WATER, 0, 5, 0.0f, TextureAnimation.WATER_STILL, TextureAnimation.WATER_FLOW);
registerFluid("lava", "Lava", LiquidType.LAVA, 15, -30, 0.0f, 2, 3);
registerFluid("magma", "Magma", LiquidType.HOT, 15, 40, 0.0f, TextureAnimation.MAGMA_STILL, TextureAnimation.MAGMA_FLOW);
registerFluid("plasma", "Plasma", LiquidType.HOT, 15, 15, 0.0f, 2, 2);
registerFluid("lava", "Lava", LiquidType.LAVA, 0xffcfaf, -30, 0.0f, 2, 3);
registerFluid("magma", "Magma", LiquidType.HOT, 0xffaf8f, 40, 0.0f, TextureAnimation.MAGMA_STILL, TextureAnimation.MAGMA_FLOW);
registerFluid("plasma", "Plasma", LiquidType.HOT, 0xff7f00, 15, 0.0f, 2, 2);
registerFluid("mercury", "Quecksilber", LiquidType.COLD, 0, 40, 0.0f, 8, 4);
registerFluid("hydrogen", "Wasserstoff", LiquidType.COLD, 0, 50, 0.0f, 8, 4);
registerFluid("acid", "Säure", LiquidType.HOT, 0, 5, 0.0f, 1, 1);
@ -271,7 +271,7 @@ public abstract class BlockRegistry {
Block brown_mushroom = (new BlockMushroom()).setHardness(0.0F).setSound(SoundType.GRASS).setLight(0.125F)
Block brown_mushroom = (new BlockMushroom()).setHardness(0.0F).setSound(SoundType.GRASS).setLight(0x1f1f1f)
.setDisplay("Pilz");
register("brown_mushroom", brown_mushroom);
register("brown_mushroom_block", (new BlockHugeMushroom(brown_mushroom)).setHardness(0.2F)
@ -280,7 +280,7 @@ public abstract class BlockRegistry {
register("red_mushroom", red_mushrooom);
register("red_mushroom_block", (new BlockHugeMushroom(red_mushrooom)).setHardness(0.2F)
.setSound(SoundType.WOOD).setDisplay("Pilzblock").setTab(CheatTab.PLANTS));
register("blue_mushroom", (new BlockBlueShroom()).setHardness(0.0F).setSound(SoundType.GRASS).setLight(0.5F)
register("blue_mushroom", (new BlockBlueShroom()).setHardness(0.0F).setSound(SoundType.GRASS).setLight(0x00007f)
.setDisplay("Tianpilz"));
Block pumpkin = (new BlockPumpkin()).setHardness(1.0F).setSound(SoundType.WOOD).setDisplay("Kürbis");
@ -317,9 +317,9 @@ public abstract class BlockRegistry {
register("web", (new BlockWeb()).setOpacity(1).setHardness(4.0F).setDisplay("Spinnennetz"));
register("fire", (new BlockFire()).setHardness(0.0F).setLight(1.0F).setSound(SoundType.CLOTH).setDisplay("Feuer"));
register("black_fire", (new BlockBlackFire()).setHardness(0.0F).setLight(1.0F).setSound(SoundType.CLOTH).setDisplay("Dunkles Feuer"));
register("soul_fire", (new BlockSoulFire()).setHardness(0.0F).setLight(1.0F).setSound(SoundType.CLOTH).setDisplay("Feuer der Seelen"));
register("fire", (new BlockFire()).setHardness(0.0F).setLight(0xffffbf).setSound(SoundType.CLOTH).setDisplay("Feuer"));
register("black_fire", (new BlockBlackFire()).setHardness(0.0F).setLight(0x7f7f7f).setSound(SoundType.CLOTH).setDisplay("Dunkles Feuer"));
register("soul_fire", (new BlockSoulFire()).setHardness(0.0F).setLight(0x0000ff).setSound(SoundType.CLOTH).setDisplay("Feuer der Seelen"));
register("glass", (new BlockGlass()).setHardness(0.3F).setSound(SoundType.GLASS).setDisplay("Glas"));
@ -348,7 +348,7 @@ public abstract class BlockRegistry {
register("bookshelf", (new BlockBookshelf()).setHardness(1.5F).setSound(SoundType.WOOD).setDisplay("Bücherregal"));
register("cake", (new BlockCake()).setHardness(0.5F).setSound(SoundType.CLOTH).setDisplay("Kuchen").setTab(CheatTab.DECORATION));
register("dragon_egg", (new BlockDragonEgg()).setHardness(3.0F).setResistance(15.0F).setSound(SoundType.STONE)
.setLight(0.125F).setDisplay("Drachenei").setTab(CheatTab.DECORATION));
.setLight(0x1f001f).setDisplay("Drachenei").setTab(CheatTab.DECORATION));
register("flowerpot", (new BlockFlowerPot(null)).setHardness(0.0F).setSound(SoundType.STONE).setDisplay("Blumentopf").setTab(CheatTab.DECORATION));
register("flowerpot_cactus", (new BlockFlowerPot(cactus)).setHardness(0.0F).setSound(SoundType.STONE).setDisplay("Blumentopf mit " + cactus.getDisplay()));
for(BlockFlower.EnumFlowerType type : BlockFlower.EnumFlowerType.values()) {
@ -371,10 +371,10 @@ public abstract class BlockRegistry {
for(PortalType portal : PortalType.values()) {
if(portal != PortalType.FLOOR && portal != PortalType.VOID)
register(portal.getName() + "_portal", (new BlockPortal(portal)).setHardness(0.0F).setSound(SoundType.GLASS).setLight(0.75F).setDisplay(portal.getDisplay()));
register(portal.getName() + "_portal", (new BlockPortal(portal)).setHardness(0.0F).setSound(SoundType.GLASS).setLight(0x1f1f1f).setDisplay(portal.getDisplay()));
}
register(PortalType.FLOOR.getName() + "_portal", (new BlockFloorPortal(Material.PORTAL)).setHardness(0.0F).setDisplay(PortalType.FLOOR.getDisplay()));
register("portal_frame", (new BlockPortalFrame()).setSound(SoundType.GLASS).setLight(0.125F).setHardness(5.0F)
register("portal_frame", (new BlockPortalFrame()).setSound(SoundType.GLASS).setLight(0x1f002f).setHardness(5.0F)
.setDisplay("Portalrahmen").setResistance(2000.0F).setTab(CheatTab.TECHNOLOGY));
register("farmland", (new BlockFarmland()).setHardness(0.6F).setSound(SoundType.GRAVEL).setDisplay("Ackerboden").setMiningTool(Equipment.SHOVEL).setTab(CheatTab.PLANTS));
@ -589,9 +589,9 @@ public abstract class BlockRegistry {
register("anvil" + (z == 0 ? "" : "_damaged_" + z), (new BlockAnvil(z)).setHardness(5.0F).setSound(SoundType.ANVIL).setResistance(2000.0F).setDisplay((z == 0 ? "" : (z == 1 ? "Leicht beschädigter " : "Stark beschädigter ")) + "Amboss"));
}
register("enchanting_table", (new BlockEnchantmentTable()).setHardness(5.0F).setResistance(2000.0F).setDisplay("Zaubertisch"));
register("brewing_stand", (new BlockBrewingStand()).setHardness(0.5F).setLight(0.125F).setDisplay("Braustand").setTab(CheatTab.TECHNOLOGY));
register("brewing_stand", (new BlockBrewingStand()).setHardness(0.5F).setLight(0x1f1f18).setDisplay("Braustand").setTab(CheatTab.TECHNOLOGY));
register("cauldron", (new BlockCauldron()).setHardness(2.0F).setDisplay("Kessel").setTab(CheatTab.TECHNOLOGY));
register("effect_generator", (new BlockEffectGenerator()).setDisplay("Effektgenerator").setLight(1.0F));
register("effect_generator", (new BlockEffectGenerator()).setDisplay("Effektgenerator").setLight(0xffffff));
register("wood_chest", new BlockChest(9, 3).setDisplay("Holztruhe"));
register("stone_chest", new BlockChest(9, 6).setDisplay("Steintruhe"));
@ -602,7 +602,7 @@ public abstract class BlockRegistry {
register("black_metal_chest", new BlockChest(28, 18).setDisplay("Schwarzmetalltruhe"));
register("nichun_chest", new BlockChest(32, 18).setDisplay("Nichuntruhe"));
register("warp_chest", (new BlockWarpChest()).setHardness(22.5F).setResistance(1000.0F).setSound(SoundType.STONE)
.setDisplay("Warptruhe").setLight(0.5F));
.setDisplay("Warptruhe").setLight(0x7f00af));
for(int z = 0; z < BlockTNT.TNTS.length; z++) {
register("tnt" + (z == 0 ? "" : "_" + z), (new BlockTNT(z)).setHardness(0.0F).setSound(SoundType.GRASS).setDisplay("TNT" + Util.getTierSuffix(z)));
@ -639,14 +639,14 @@ public abstract class BlockRegistry {
register("wire", (new BlockWire()).setHardness(0.0F).setSound(SoundType.STONE).setDisplay("Kabel").setTab(CheatTab.TECHNOLOGY));
BlockUnlitTorch torch;
register("torch", (torch = new BlockUnlitTorch(0xffffffff)).setHardness(0.0F).setSound(SoundType.WOOD).setDisplay("Fackel"));
register("lit_torch", (new BlockLitTorch(torch)).setHardness(0.0F).setLight(0.9375F).setSound(SoundType.WOOD).setDisplay("Fackel"));
register("lit_torch", (new BlockLitTorch(torch)).setHardness(0.0F).setLight(0xefef9f).setSound(SoundType.WOOD).setDisplay("Fackel"));
BlockUnlitTorch tian_torch;
register("tian_torch", (tian_torch = new BlockUnlitTorch(0x7f00ff)).setHardness(0.0F).setSound(SoundType.WOOD).setDisplay("Tian-Fackel"));
register("lit_tian_torch", (new BlockLitTorch(tian_torch)).setHardness(0.0F).setLight(0.5F).setSound(SoundType.WOOD)
register("lit_tian_torch", (new BlockLitTorch(tian_torch)).setHardness(0.0F).setLight(0xaf00ff).setSound(SoundType.WOOD)
.setDisplay("Tian-Fackel"));
BlockUnlitTorch soul_torch;
register("soul_torch", (soul_torch = new BlockUnlitTorch(0x1f1fff)).setHardness(0.0F).setSound(SoundType.WOOD).setDisplay("Seelenfackel"));
register("lit_soul_torch", (new BlockLitTorch(soul_torch)).setHardness(0.0F).setLight(0.75F).setSound(SoundType.WOOD)
register("lit_soul_torch", (new BlockLitTorch(soul_torch)).setHardness(0.0F).setLight(0x0000af).setSound(SoundType.WOOD)
.setDisplay("Seelenfackel"));
register("lamp", (new BlockToggleableLight(false)).setHardness(0.3F).setSound(SoundType.GLASS)
.setDisplay("Lampe").setTab(CheatTab.TECHNOLOGY));

View file

@ -15,7 +15,7 @@ public class BlockArray {
private int ticked;
private int filled;
private char[] data;
private NibbleArray blocklight;
private int[] blocklight;
public BlockArray(int y, State filler) {
this.yBase = y;
@ -113,12 +113,12 @@ public class BlockArray {
public void setLight(int x, int y, int z, int value) {
if(this.blocklight == null)
this.blocklight = new NibbleArray();
this.blocklight.set(x, y, z, value);
this.blocklight = new int[4096];
this.blocklight[y << 8 | z << 4 | x] = value;
}
public int getLight(int x, int y, int z) {
return this.blocklight == null ? 0 : this.blocklight.get(x, y, z);
return this.blocklight == null ? 0 : this.blocklight[y << 8 | z << 4 | x];
}
public void clearLight() {

View file

@ -8,5 +8,5 @@ public interface IWorldAccess extends IBlockAccess
{
TileEntity getTileEntity(BlockPos pos);
@Clientside
int getCombinedLight(BlockPos pos, int lightValue);
int getCombinedLight(BlockPos pos);
}

View file

@ -187,7 +187,7 @@ public abstract class World implements IWorldAccess {
public void checkBlockLight(BlockPos pos) {
}
public int getCombinedLight(BlockPos pos, int lightValue) {
public int getCombinedLight(BlockPos pos) {
return 0;
}