some radiation handling stuff

This commit is contained in:
Boblet 2021-05-19 11:36:32 +02:00
parent f01d1bfbb5
commit ce04dd5265
9 changed files with 178 additions and 0 deletions

View File

@ -0,0 +1,29 @@
package com.hbm.handler.radiation;
import net.minecraft.world.World;
import net.minecraftforge.event.world.ChunkDataEvent;
import net.minecraftforge.event.world.ChunkEvent;
import net.minecraftforge.event.world.WorldEvent;
public abstract class ChunkRadiationHandler {
/**
* Updates the radiation system, i.e. all worlds.
* Doesn't need parameters because it governs the ENTIRE system.
*/
public abstract void updateSystem();
public abstract float getRadiation(World world, int x, int y, int z);
public abstract void setRadiation(World world, int x, int y, int z, float rad);
public abstract void incrementRad(World world, int x, int y, int z, float rad);
public abstract void decrementRad(World world, int x, int y, int z, float rad);
/*
* Proxy'd event handlers
*/
public void receiveWorldLoad(WorldEvent.Load event) { }
public void receiveWorldUnload(WorldEvent.Unload event) { }
public void receiveChunkLoad(ChunkDataEvent.Load event) { }
public void receiveChunkSave(ChunkDataEvent.Save event) { }
public void receiveChunkUnload(ChunkEvent.Unload event) { }
}

View File

@ -0,0 +1,23 @@
package com.hbm.handler.radiation;
import net.minecraft.world.World;
public class ChunkRadiationHandlerBlank extends ChunkRadiationHandler {
@Override
public float getRadiation(World world, int x, int y, int z) {
return 0;
}
@Override
public void setRadiation(World world, int x, int y, int z, float rad) { }
@Override
public void incrementRad(World world, int x, int y, int z, float rad) { }
@Override
public void decrementRad(World world, int x, int y, int z, float rad) { }
@Override
public void updateSystem() { }
}

View File

@ -0,0 +1,36 @@
package com.hbm.handler.radiation;
import net.minecraft.world.World;
public class ChunkRadiationHandlerNT extends ChunkRadiationHandler {
@Override
public float getRadiation(World world, int x, int y, int z) {
// TODO Auto-generated method stub
return 0;
}
@Override
public void setRadiation(World world, int x, int y, int z, float rad) {
// TODO Auto-generated method stub
}
@Override
public void incrementRad(World world, int x, int y, int z, float rad) {
// TODO Auto-generated method stub
}
@Override
public void decrementRad(World world, int x, int y, int z, float rad) {
// TODO Auto-generated method stub
}
@Override
public void updateSystem() {
// TODO Auto-generated method stub
}
}

View File

@ -0,0 +1,36 @@
package com.hbm.handler.radiation;
import net.minecraft.world.World;
public class ChunkRadiationHandlerSimple extends ChunkRadiationHandler {
@Override
public float getRadiation(World world, int x, int y, int z) {
// TODO Auto-generated method stub
return 0;
}
@Override
public void setRadiation(World world, int x, int y, int z, float rad) {
// TODO Auto-generated method stub
}
@Override
public void incrementRad(World world, int x, int y, int z, float rad) {
// TODO Auto-generated method stub
}
@Override
public void decrementRad(World world, int x, int y, int z, float rad) {
// TODO Auto-generated method stub
}
@Override
public void updateSystem() {
// TODO Auto-generated method stub
}
}

View File

@ -0,0 +1,43 @@
package com.hbm.handler.radiation;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.TickEvent;
import net.minecraft.world.World;
import net.minecraftforge.event.world.ChunkDataEvent;
import net.minecraftforge.event.world.ChunkEvent;
import net.minecraftforge.event.world.WorldEvent;
public class ChunkRadiationManager {
public static ChunkRadiationHandler proxy;
@SubscribeEvent
public void onWorldLoad(WorldEvent.Load event) {
proxy.receiveWorldLoad(event);
}
@SubscribeEvent
public void onWorldUnload(WorldEvent.Unload event) {
proxy.receiveWorldUnload(event);
}
@SubscribeEvent
public void onChunkLoad(ChunkDataEvent.Load event) {
proxy.receiveChunkLoad(event);
}
@SubscribeEvent
public void onChunkSave(ChunkDataEvent.Save event) {
proxy.receiveChunkSave(event);
}
@SubscribeEvent
public void onChunkUnload(ChunkEvent.Unload event) {
proxy.receiveChunkUnload(event);
}
@SubscribeEvent
public void updateSystem(TickEvent.ServerTickEvent event) {
}
}

View File

@ -56,6 +56,7 @@ import com.hbm.entity.particle.*;
import com.hbm.entity.projectile.*;
import com.hbm.handler.*;
import com.hbm.handler.FluidTypeHandler.FluidType;
import com.hbm.handler.radiation.ChunkRadiationManager;
import com.hbm.inventory.*;
import com.hbm.items.ModItems;
import com.hbm.lib.HbmWorld;
@ -1136,6 +1137,8 @@ public class MainRegistry {
MinecraftForge.TERRAIN_GEN_BUS.register(new ModEventHandler());
MinecraftForge.ORE_GEN_BUS.register(new ModEventHandler());
PacketDispatcher.registerPackets();
MinecraftForge.EVENT_BUS.register(new ChunkRadiationManager());
}
//yes kids, this is where we would usually register commands

View File

@ -42,6 +42,7 @@ public class TileEntityTrappedBrick extends TileEntity {
}
}
@SuppressWarnings("incomplete-switch")
private void trigger() {
Trap trap = Trap.get(this.getBlockMetadata());
@ -106,6 +107,7 @@ public class TileEntityTrappedBrick extends TileEntity {
worldObj.setBlock(xCoord, yCoord, zCoord, ModBlocks.brick_jungle);
}
@SuppressWarnings("incomplete-switch")
private void setDetector() {
Trap trap = Trap.get(this.getBlockMetadata());

View File

@ -525,6 +525,9 @@ item.ammo_container.name=Munitionsbehälter
item.ammo_dart.name=Plastikdart (Withernd)
item.ammo_dart_nerf.name=NERF-Dart
item.ammo_dgk.name=Goalkeeper-Zwilling CIWS 200er Gürtel
item.ammo_fireext.name=Feuerlöscher-Wassertank
item.ammo_fireext_foam.name=Feuerlöscher-Schaumtank
item.ammo_fireext_sand.name=Feuerlöscher-Sandtank
item.ammo_folly.name=Silbernes Geschoss (Original)
item.ammo_folly_du.name=Silbernes Geschoss (DU, Nicht-Explosiv)
item.ammo_folly_nuclear.name=Silbernes Geschoss (Atomar)

View File

@ -593,6 +593,9 @@ item.ammo_container.name=Ammo Container
item.ammo_dart.name=Plastic Dart (Withering)
item.ammo_dart_nerf.name=NERF Dart
item.ammo_dgk.name=Goalkeeper Twin CIWS 200 Round Belt
item.ammo_fireext.name=Fire Extinguisher Water Tank
item.ammo_fireext_foam.name=Fire Extinguisher Foam Tank
item.ammo_fireext_sand.name=Fire Extinguisher Sand Tank
item.ammo_folly.name=Silver Bullet (Original)
item.ammo_folly_du.name=Silver Bullet (DU, Non-Explosive)
item.ammo_folly_nuclear.name=Silver Bullet (Nuclear)