Skip to content

Commit

Permalink
Fixes and RBMk Redstone stuff
Browse files Browse the repository at this point in the history
Added Redstone RBMK control
Added small chance for DNT armored Zombie

Changed Desh Defuser recipes

Fixed Server loading crash
Fixed Balefire + TNT
Fixed PLATE APPROVED spam
Fixed RBMK Boiler fluid loss
Fixed RBMK Console flux inaccuracy
Fixed RBMK Debris amount
Fixed Turbofan noise issue
Fixed Battery Null Priority
Fixed Polymer and Desh plate
Fixed Item results of consumables
Fixed XP amount of IV_xp_bag
Fixed old mask recipes
Fixed leg movements
Fixed barrel corrosion
Fixed missing fusion_hatch model
  • Loading branch information
Alcatergit committed May 14, 2023
1 parent 4c63c60 commit 9a6b64b
Show file tree
Hide file tree
Showing 33 changed files with 319 additions and 367 deletions.
1 change: 0 additions & 1 deletion src/main/java/api/hbm/energy/IEnergyConnector.java
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ public default ConnectionPriority getPriority() {
}

public enum ConnectionPriority {
NULL,
LOW,
NORMAL,
HIGH
Expand Down
138 changes: 2 additions & 136 deletions src/main/java/com/hbm/blocks/bomb/Balefire.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,11 @@
import com.hbm.blocks.ModBlocks;
import com.hbm.potion.HbmPotion;

import net.minecraft.block.Block;
import net.minecraft.block.BlockFire;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.init.Blocks;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;

Expand All @@ -27,147 +24,16 @@ public Balefire(String s) {
ModBlocks.ALL_BLOCKS.add(this);
}

public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) {
if (worldIn.getGameRules().getBoolean("doFireTick")) {
if (!worldIn.isAreaLoaded(pos, 2))
return; // Forge: prevent loading unloaded chunks when spreading
// fire
if (!this.canPlaceBlockAt(worldIn, pos)) {
worldIn.setBlockToAir(pos);
}

Block block = worldIn.getBlockState(pos.down()).getBlock();
boolean flag = block.isFireSource(worldIn, pos.down(), EnumFacing.UP);

int i = ((Integer) state.getValue(AGE)).intValue();

/* if (!flag && worldIn.isRaining() && this.canDie(worldIn, pos) && rand.nextFloat() < 0.2F + (float)i * 0.03F)
{
worldIn.setBlockToAir(pos);
}
else*/
{
/* if (i < 15)
{
state = state.withProperty(AGE, Integer.valueOf(i + rand.nextInt(3) / 2));
worldIn.setBlockState(pos, state, 4);
}*/

worldIn.scheduleUpdate(pos, this, this.tickRate(worldIn) + rand.nextInt(10));

if (!flag) {
if (!this.canNeighborCatchFire(worldIn, pos)) {
if (!worldIn.getBlockState(pos.down()).isSideSolid(worldIn, pos.down(), EnumFacing.UP) || i > 3) {
worldIn.setBlockToAir(pos);
}

return;
}

/* if (!this.canCatchFire(worldIn, pos.down(), EnumFacing.UP) && i == 15 && rand.nextInt(4) == 0)
{
worldIn.setBlockToAir(pos);
return;
}*/
}

boolean flag1 = worldIn.isBlockinHighHumidity(pos);
int j = 0;

if (flag1) {
j = -50;
}

this.tryCatchFire(worldIn, pos.east(), 300 + j, rand, i, EnumFacing.WEST);
this.tryCatchFire(worldIn, pos.west(), 300 + j, rand, i, EnumFacing.EAST);
this.tryCatchFire(worldIn, pos.down(), 250 + j, rand, i, EnumFacing.UP);
this.tryCatchFire(worldIn, pos.up(), 250 + j, rand, i, EnumFacing.DOWN);
this.tryCatchFire(worldIn, pos.north(), 300 + j, rand, i, EnumFacing.SOUTH);
this.tryCatchFire(worldIn, pos.south(), 300 + j, rand, i, EnumFacing.NORTH);

for (int k = -1; k <= 1; ++k) {
for (int l = -1; l <= 1; ++l) {
for (int i1 = -1; i1 <= 4; ++i1) {
if (k != 0 || i1 != 0 || l != 0) {
int j1 = 100;

if (i1 > 1) {
j1 += (i1 - 1) * 100;
}

BlockPos blockpos = pos.add(k, i1, l);
int k1 = this.getNeighborEncouragement(worldIn, blockpos);

if (k1 > 0) {
int l1 = (k1 + 40 + worldIn.getDifficulty().getDifficultyId() * 7) / (i + 30);

/* if (flag1)
{
l1 /= 2;
}*/

if (l1 > 0 && rand.nextInt(j1) <= l1/* && (!worldIn.isRaining() || !this.canDie(worldIn, blockpos))*/) {
int i2 = i + rand.nextInt(5) / 4;

if (i2 > 15) {
i2 = 15;
}

worldIn.setBlockState(blockpos, state.withProperty(AGE, Integer.valueOf(i2)), 3);
}
}
}
}
}
}
}
}
}

private boolean canNeighborCatchFire(World worldIn, BlockPos pos) {
for (EnumFacing enumfacing : EnumFacing.values()) {
if (this.canCatchFire(worldIn, pos.offset(enumfacing), enumfacing.getOpposite())) {
return true;
}
}

@Override
protected boolean canDie(World worldIn, BlockPos pos){
return false;
}

private int getNeighborEncouragement(World worldIn, BlockPos pos) {
if (!worldIn.isAirBlock(pos)) {
return 0;
} else {
int i = 0;

for (EnumFacing enumfacing : EnumFacing.values()) {
i = Math.max(worldIn.getBlockState(pos.offset(enumfacing)).getBlock().getFireSpreadSpeed(worldIn, pos.offset(enumfacing), enumfacing.getOpposite()), i);
}

return i;
}
}

private void tryCatchFire(World p_149841_1_, BlockPos pos, int p_149841_5_, Random p_149841_6_, int p_149841_7_, EnumFacing face) {
int j1 = p_149841_1_.getBlockState(pos).getBlock().getFlammability(p_149841_1_, pos, face);

if (p_149841_6_.nextInt(p_149841_5_) < j1) {
boolean flag = p_149841_1_.getBlockState(pos).getBlock() == Blocks.TNT;

p_149841_1_.setBlockState(pos, this.getDefaultState().withProperty(AGE, 15), 3);

if (flag) {
Blocks.TNT.onBlockDestroyedByPlayer(p_149841_1_, pos, p_149841_1_.getBlockState(pos));
}
}
}

@Override
public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn) {
entityIn.setFire(10);

if (entityIn instanceof EntityLivingBase)
((EntityLivingBase) entityIn).addPotionEffect(new PotionEffect(HbmPotion.radiation, 5 * 20, 9));
}

}
2 changes: 1 addition & 1 deletion src/main/java/com/hbm/blocks/fluid/SchrabidicBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public boolean displaceIfPossible(World world, BlockPos pos) {
public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entity) {
entity.setInWeb();
if(entity instanceof EntityLivingBase)
ContaminationUtil.contaminate((EntityLivingBase)entity, HazardType.RADIATION, ContaminationType.CREATIVE, 1.0F);
ContaminationUtil.contaminate((EntityLivingBase)entity, HazardType.RADIATION, ContaminationType.CREATIVE, 10.0F);
}

@Override
Expand Down
37 changes: 36 additions & 1 deletion src/main/java/com/hbm/blocks/machine/rbmk/RBMKConsole.java
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
package com.hbm.blocks.machine.rbmk;

import java.util.List;

import com.hbm.blocks.BlockDummyable;
import com.hbm.blocks.ModBlocks;
import com.hbm.blocks.ITooltipProvider;
import com.hbm.handler.BossSpawnHandler;
import com.hbm.handler.MultiblockHandlerXR;
import com.hbm.items.ModItems;
import com.hbm.items.tool.ItemGuideBook.BookType;
import com.hbm.lib.ForgeDirection;
import com.hbm.main.MainRegistry;
import com.hbm.packet.NBTControlPacket;
import com.hbm.packet.PacketDispatcher;
import com.hbm.render.amlfrom1710.Vec3;
import com.hbm.tileentity.machine.rbmk.TileEntityRBMKConsole;
import com.hbm.tileentity.machine.rbmk.TileEntityRBMKConsole.ColumnType;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
Expand All @@ -20,11 +27,13 @@
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.network.internal.FMLNetworkHandler;

public class RBMKConsole extends BlockDummyable {
public class RBMKConsole extends BlockDummyable implements ITooltipProvider {

public RBMKConsole(String s) {
super(Material.IRON, s);
Expand All @@ -39,6 +48,26 @@ public TileEntity createNewTileEntity(World world, int meta) {
return null;
}

@Override
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos) {
super.neighborChanged(state, world, pos, blockIn, fromPos);
if(state.getValue(META) >= offset){
int power = world.isBlockIndirectlyGettingPowered(pos);
if(power > 0 && power <= 15){
TileEntityRBMKConsole console = (TileEntityRBMKConsole) world.getTileEntity(pos);
NBTTagCompound control = new NBTTagCompound();
control.setDouble("level", (15D-power)/14D);

for(int j = 0; j < console.columns.length; j++) {
if(console.columns[j] != null && console.columns[j].type == ColumnType.CONTROL)
control.setInteger("sel_" + j, j);
}

PacketDispatcher.wrapper.sendToServer(new NBTControlPacket(control, console.getPos()));
}
}
}

@Override
public EnumBlockRenderType getRenderType(IBlockState state) {
return EnumBlockRenderType.ENTITYBLOCK_ANIMATED;
Expand Down Expand Up @@ -139,4 +168,10 @@ protected boolean checkRequirement(World world, int x, int y, int z, ForgeDirect

return super.checkRequirement(world, x, y, z, dir, o);
}

@Override
public void addInformation(ItemStack stack, World worldIn, List<String> list, ITooltipFlag flagIn) {
this.addStandardInfo(list);
super.addInformation(stack, worldIn, list, flagIn);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ public void printHook(Pre event, World world, int x, int y, int z) {
if(ductFluid == null){
text.add("§7None");
} else{
int color = ModForgeFluids.fluidColors.get(ductFluid);
int color = ModForgeFluids.getFluidColor(ductFluid);
text.add("&[" + color + "&]" +I18nUtil.resolveKey(ductFluid.getUnlocalizedName()));
}

Expand Down
21 changes: 9 additions & 12 deletions src/main/java/com/hbm/entity/projectile/EntityRBMKDebris.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import com.hbm.items.ModItems;
import com.hbm.potion.HbmPotion;
import com.hbm.util.ContaminationUtil;
import com.hbm.render.amlfrom1710.Vec3;
import com.hbm.tileentity.machine.rbmk.RBMKDials;

Expand Down Expand Up @@ -62,7 +63,7 @@ public boolean canBeCollidedWith(){

@Override
public boolean processInitialInteract(EntityPlayer player, EnumHand hand){
if(!world.isRemote) {
if(!world.isRemote && !isDead) {
switch(this.getType()){
case BLANK:
if(player.inventory.addItemStackToInventory(new ItemStack(ModItems.debris_metal)))
Expand Down Expand Up @@ -179,11 +180,7 @@ public void onUpdate(){
}

if(this.getType() == DebrisType.FUEL) {
List<EntityLivingBase> entities = world.getEntitiesWithinAABB(EntityLivingBase.class, this.getEntityBoundingBox().grow(10, 10, 10));

for(EntityLivingBase e : entities) {
e.addPotionEffect(new PotionEffect(HbmPotion.radiation, 60 * 20, 9));
}
ContaminationUtil.radiate(world, this.posX, this.posY, this.posZ, 16, 100);
}

if(!RBMKDials.getPermaScrap(world) && this.ticksExisted > getLifetime() + this.getEntityId() % 50)
Expand All @@ -195,17 +192,17 @@ private int getLifetime(){

switch(this.getType()){
case BLANK:
return 3 * 60 * 20;
return 30 * 60 * 20;
case ELEMENT:
return 3 * 60 * 20;
return 30 * 60 * 20;
case FUEL:
return 10 * 60 * 20;
return 100 * 60 * 20;
case GRAPHITE:
return 15 * 60 * 20;
return 150 * 60 * 20;
case LID:
return 30 * 20;
return 300 * 20;
case ROD:
return 60 * 20;
return 600 * 20;
default:
return 0;
}
Expand Down
9 changes: 9 additions & 0 deletions src/main/java/com/hbm/forgefluid/ModForgeFluids.java
Original file line number Diff line number Diff line change
Expand Up @@ -380,4 +380,13 @@ public static void registerFluidColors(){
fluidColors.put(f, FFUtils.getColorFromFluid(f));
}
}

public static int getFluidColor(Fluid f){
if(f == null)
return 0;
Integer color = fluidColors.get(f);
if(color == null)
return 0xFFFFFF;
return color;
}
}
Loading

0 comments on commit 9a6b64b

Please sign in to comment.