electric press IO, boxduct and chemplant fixes, mask man despawn trigger

This commit is contained in:
Bob 2022-11-27 17:35:56 +01:00
parent ce34f9ca77
commit 86a2a2fcc1
17 changed files with 234 additions and 86 deletions

View File

@ -3162,8 +3162,8 @@ public class ModBlocks {
GameRegistry.registerBlock(fluid_duct_neo, ItemBlockBase.class, fluid_duct_neo.getUnlocalizedName());
GameRegistry.registerBlock(fluid_duct_box, ItemBlockBase.class, fluid_duct_box.getUnlocalizedName());
GameRegistry.registerBlock(fluid_duct_solid, fluid_duct_solid.getUnlocalizedName());
GameRegistry.registerBlock(radio_torch_sender, radio_torch_sender.getUnlocalizedName());
GameRegistry.registerBlock(radio_torch_receiver, radio_torch_receiver.getUnlocalizedName());
register(radio_torch_sender);
register(radio_torch_receiver);
GameRegistry.registerBlock(crane_extractor, crane_extractor.getUnlocalizedName());
GameRegistry.registerBlock(crane_inserter, crane_inserter.getUnlocalizedName());

View File

@ -135,7 +135,7 @@ public class FluidDuctBox extends FluidDuctBase implements IBlockMulti, ILookOve
}
public int damageDropped(int meta) {
return rectify(meta);
return meta % 15;
}
public static int renderID = RenderingRegistry.getNextAvailableRenderId();

View File

@ -1,26 +1,40 @@
package com.hbm.blocks.network;
import java.util.ArrayList;
import java.util.List;
import com.hbm.blocks.ILookOverlay;
import com.hbm.blocks.ITooltipProvider;
import com.hbm.inventory.gui.GUIScreenRadioTorch;
import com.hbm.main.MainRegistry;
import com.hbm.tileentity.IGUIProvider;
import com.hbm.tileentity.network.TileEntityRadioTorchBase;
import com.hbm.util.I18nUtil;
import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.IIcon;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
import net.minecraftforge.common.util.ForgeDirection;
public abstract class RadioTorchBase extends BlockContainer implements IGUIProvider, ILookOverlay, ITooltipProvider {
public abstract class RadioTorchBase extends BlockContainer implements IGUIProvider {
@SideOnly(Side.CLIENT) protected IIcon iconOn;
public RadioTorchBase() {
@ -49,6 +63,29 @@ public abstract class RadioTorchBase extends BlockContainer implements IGUIProvi
public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) {
return true;
}
@Override
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
return null;
}
@Override
public MovingObjectPosition collisionRayTrace(World world, int x, int y, int z, Vec3 vec0, Vec3 vec1) {
int meta = world.getBlockMetadata(x, y, z) & 7;
ForgeDirection dir = ForgeDirection.getOrientation(meta);
this.setBlockBounds(
dir.offsetX == 1 ? 0F : 0.375F,
dir.offsetY == 1 ? 0F : 0.375F,
dir.offsetZ == 1 ? 0F : 0.375F,
dir.offsetX == -1 ? 1F : 0.625F,
dir.offsetY == -1 ? 1F : 0.625F,
dir.offsetZ == -1 ? 1F : 0.625F
);
return super.collisionRayTrace(world, x, y, z, vec0, vec1);
}
@Override
@SideOnly(Side.CLIENT)
@ -60,6 +97,29 @@ public abstract class RadioTorchBase extends BlockContainer implements IGUIProvi
public int onBlockPlaced(World world, int x, int y, int z, int side, float fX, float fY, float fZ, int meta) {
return side;
}
@Override
public void onNeighborBlockChange(World world, int x, int y, int z, Block block) {
int meta = world.getBlockMetadata(x, y, z);
ForgeDirection dir = ForgeDirection.getOrientation(meta);
Block b = world.getBlock(x - dir.offsetX, y - dir.offsetY, z - dir.offsetZ);
if(!b.isSideSolid(world, x - dir.offsetX, y - dir.offsetY, z - dir.offsetZ, dir) && !b.hasComparatorInputOverride() && (!b.renderAsNormalBlock() || b.isAir(world, x, y, z))) {
this.dropBlockAsItem(world, x, y, z, meta, 0);
world.setBlockToAir(x, y, z);
}
}
@Override
public boolean canPlaceBlockOnSide(World world, int x, int y, int z, int side) {
if(!super.canPlaceBlockOnSide(world, x, y, z, side)) return false;
ForgeDirection dir = ForgeDirection.getOrientation(side);
Block b = world.getBlock(x - dir.offsetX, y - dir.offsetY, z - dir.offsetZ);
return b.isSideSolid(world, x - dir.offsetX, y - dir.offsetY, z - dir.offsetZ, dir) || b.hasComparatorInputOverride() || (b.renderAsNormalBlock() && !b.isAir(world, x, y, z));
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
@ -70,6 +130,25 @@ public abstract class RadioTorchBase extends BlockContainer implements IGUIProvi
return !player.isSneaking();
}
}
@Override
@SideOnly(Side.CLIENT)
public void printHook(Pre event, World world, int x, int y, int z) {
TileEntity te = world.getTileEntity(x, y, z);
if(te instanceof TileEntityRadioTorchBase) {
TileEntityRadioTorchBase radio = (TileEntityRadioTorchBase) te;
List<String> text = new ArrayList();
if(radio.channel != null && !radio.channel.isEmpty()) text.add(EnumChatFormatting.AQUA + "Freq: " + radio.channel);
text.add(EnumChatFormatting.RED + "Signal: " + radio.lastState);
ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text);
}
}
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean ext) {
addStandardInfo(stack, player, list, ext);
}
@Override public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) { return null; }

View File

@ -25,7 +25,9 @@ public class RadioTorchReceiver extends RadioTorchBase {
@Override
public TileEntity createNewTileEntity(World world, int meta) {
return new TileEntityRadioTorchReceiver();
TileEntityRadioTorchReceiver tile = new TileEntityRadioTorchReceiver();
tile.lastUpdate = world.getTotalWorldTime();
return tile;
}
@Override

View File

@ -19,8 +19,10 @@ import net.minecraft.entity.ai.EntityAIWatchClosest;
import net.minecraft.entity.boss.IBossDisplayData;
import net.minecraft.entity.monster.EntityMob;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityEgg;
import net.minecraft.init.Items;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EntityDamageSourceIndirect;
import net.minecraft.world.World;
public class EntityMaskMan extends EntityMob implements IBossDisplayData, IRadiationImmune {
@ -28,87 +30,98 @@ public class EntityMaskMan extends EntityMob implements IBossDisplayData, IRadia
public EntityMaskMan(World world) {
super(world);
this.tasks.addTask(1, new EntityAISwimming(this));
this.tasks.addTask(2, new EntityAIMaskmanCasualApproach(this, EntityPlayer.class, 1.0D, false));
this.tasks.addTask(2, new EntityAIMaskmanMinigun(this, true, true, 3));
this.tasks.addTask(3, new EntityAIMaskmanLasergun(this, true, true));
this.tasks.addTask(3, new EntityAIWander(this, 1.0D));
this.tasks.addTask(4, new EntityAILookIdle(this));
this.tasks.addTask(5, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, false));
this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 0, true));
this.tasks.addTask(1, new EntityAISwimming(this));
this.tasks.addTask(2, new EntityAIMaskmanCasualApproach(this, EntityPlayer.class, 1.0D, false));
this.tasks.addTask(2, new EntityAIMaskmanMinigun(this, true, true, 3));
this.tasks.addTask(3, new EntityAIMaskmanLasergun(this, true, true));
this.tasks.addTask(3, new EntityAIWander(this, 1.0D));
this.tasks.addTask(4, new EntityAILookIdle(this));
this.tasks.addTask(5, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, false));
this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 0, true));
this.setSize(2F, 5F);
this.isImmuneToFire = true;
this.experienceValue = 100;
this.experienceValue = 100;
}
protected void applyEntityAttributes() {
super.applyEntityAttributes();
this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.25D);
this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(100.0D);
this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(15.0D);
this.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).setBaseValue(1.0D);
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(1000.0D);
}
public boolean attackEntityFrom(DamageSource source, float amount) {
if(source.isFireDamage())
amount = 0;
if(source.isMagicDamage())
amount = 0;
if(source.isProjectile())
amount *= 0.25F;
if(source.isExplosion())
amount *= 0.5F;
if(amount > 50) {
amount = 50 + (amount - 50) * 0.25F;
}
return super.attackEntityFrom(source, amount);
}
public void onUpdate() {
super.onUpdate();
if(this.prevHealth >= this.getMaxHealth() / 2 && this.getHealth() < this.getMaxHealth() / 2) {
prevHealth = this.getHealth();
if(!worldObj.isRemote)
worldObj.createExplosion(this, posX, posY + 4, posZ, 2.5F, true);
}
}
@Override
@Override
protected void applyEntityAttributes() {
super.applyEntityAttributes();
this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.25D);
this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(100.0D);
this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(15.0D);
this.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).setBaseValue(1.0D);
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(1000.0D);
}
@Override
public boolean attackEntityFrom(DamageSource source, float amount) {
if(source instanceof EntityDamageSourceIndirect && ((EntityDamageSourceIndirect) source).getSourceOfDamage() instanceof EntityEgg && rand.nextInt(10) == 0) {
this.experienceValue = 0;
this.setHealth(0);
return true;
}
if(source.isFireDamage())
amount = 0;
if(source.isMagicDamage())
amount = 0;
if(source.isProjectile())
amount *= 0.25F;
if(source.isExplosion())
amount *= 0.5F;
if(amount > 50) {
amount = 50 + (amount - 50) * 0.25F;
}
return super.attackEntityFrom(source, amount);
}
@Override
public void onUpdate() {
super.onUpdate();
if(this.prevHealth >= this.getMaxHealth() / 2 && this.getHealth() < this.getMaxHealth() / 2 && this.isEntityAlive()) {
prevHealth = this.getHealth();
if(!worldObj.isRemote)
worldObj.createExplosion(this, posX, posY + 4, posZ, 2.5F, true);
}
}
@Override
public void onDeath(DamageSource p_70645_1_) {
super.onDeath(p_70645_1_);
List<EntityPlayer> players = worldObj.getEntitiesWithinAABB(EntityPlayer.class, this.boundingBox.expand(50, 50, 50));
for(EntityPlayer player : players) {
player.triggerAchievement(MainRegistry.bossMaskman);
}
}
public boolean isAIEnabled() {
return true;
}
protected boolean canDespawn() {
return false;
}
protected void dropFewItems(boolean bool, int i) {
if(!worldObj.isRemote) {
this.dropItem(ModItems.coin_maskman, 1);
this.dropItem(ModItems.gas_mask_m65, 1);
this.dropItem(ModItems.v1, 1);
this.dropItem(Items.skull, 1);
}
}
@Override
public boolean isAIEnabled() {
return true;
}
@Override
protected boolean canDespawn() {
return false;
}
@Override
protected void dropFewItems(boolean bool, int i) {
if(!worldObj.isRemote) {
this.dropItem(ModItems.coin_maskman, 1);
this.dropItem(ModItems.gas_mask_m65, 1);
this.dropItem(ModItems.v1, 1);
this.dropItem(Items.skull, 1);
}
}
}

View File

@ -36,6 +36,11 @@ public class ItemModLens extends ItemArmorMod implements ISatChip {
super.addInformation(itemstack, player, list, bool);
}
@Override
public void addDesc(List list, ItemStack stack, ItemStack armor) {
list.add(EnumChatFormatting.AQUA + " " + stack.getDisplayName() + " (Freq: " + getFreq(stack) + ")");
}
@Override
public void modUpdate(EntityLivingBase entity, ItemStack armor) {
World world = entity.worldObj;
@ -43,8 +48,11 @@ public class ItemModLens extends ItemArmorMod implements ISatChip {
if(!(entity instanceof EntityPlayerMP)) return;
EntityPlayerMP player = (EntityPlayerMP) entity;
ItemStack lens = ArmorModHandler.pryMods(armor)[ArmorModHandler.extra];
int freq = this.getFreq(armor);
if(lens == null) return;
int freq = this.getFreq(lens);
Satellite sat = SatelliteSavedData.getData(world).getSatFromFreq(freq);
if(!(sat instanceof SatelliteScanner)) return;

View File

@ -3,7 +3,7 @@ package com.hbm.lib;
public class RefStrings {
public static final String MODID = "hbm";
public static final String NAME = "Hbm's Nuclear Tech Mod";
public static final String VERSION = "1.0.27 BETA (4417)";
public static final String VERSION = "1.0.27 BETA (4431)";
//HBM's Beta Naming Convention:
//V T (X)
//V -> next release version

View File

@ -253,6 +253,9 @@ public class CraftingManager {
addShapelessAuto(new ItemStack(ModItems.toothpicks, 3), new Object[] { KEY_STICK, KEY_STICK, KEY_STICK });
addRecipeAuto(new ItemStack(ModItems.ducttape, 6), new Object[] { "FSF", "SPS", "FSF", 'F', Items.string, 'S', KEY_SLIME, 'P', Items.paper });
addRecipeAuto(new ItemStack(ModBlocks.radio_torch_sender, 4), new Object[] { "G", "R", "I", 'G', "dustGlowstone", 'R', Blocks.redstone_torch, 'I', NETHERQUARTZ.gem() });
addRecipeAuto(new ItemStack(ModBlocks.radio_torch_receiver, 4), new Object[] { "G", "R", "I", 'G', "dustGlowstone", 'R', Blocks.redstone_torch, 'I', IRON.ingot() });
addRecipeAuto(new ItemStack(ModBlocks.conveyor, 16), new Object[] { "LLL", "I I", "LLL", 'L', Items.leather, 'I', IRON.ingot() });
addRecipeAuto(new ItemStack(ModBlocks.conveyor, 16), new Object[] { "RSR", "I I", "RSR", 'I', IRON.ingot(), 'R', DictFrame.fromOne(ModItems.plant_item, EnumPlantType.ROPE), 'S', IRON.plate() });
addRecipeAuto(new ItemStack(ModBlocks.conveyor, 64), new Object[] { "LLL", "I I", "LLL", 'L', RUBBER.ingot(), 'I', IRON.ingot() });

View File

@ -79,6 +79,10 @@ public class TileEntityMachineChemfac extends TileEntityMachineChemplantBase {
this.speed /= (overLevel + 1);
this.consumption *= (overLevel + 1);
if(this.speed <= 0) {
this.speed = 1;
}
NBTTagCompound data = new NBTTagCompound();
data.setLong("power", this.power);
data.setIntArray("progress", this.progress);

View File

@ -111,9 +111,6 @@ public class TileEntityMachineEPress extends TileEntityLoadedBase implements ISi
if(stack.getItem() instanceof ItemStamp && i == 1)
return true;
if(TileEntityFurnace.getItemBurnTime(stack) > 0 && i == 0)
return true;
return i == 2;
}
@ -186,7 +183,7 @@ public class TileEntityMachineEPress extends TileEntityLoadedBase implements ISi
@Override
public int[] getAccessibleSlotsFromSide(int side)
{
return side == 0 ? new int[] { 3 } : new int[]{ 0, 1, 2 };
return new int[]{ 1, 2, 3 };
}
@Override

View File

@ -17,7 +17,7 @@ public class TileEntityRadioTorchBase extends TileEntity implements INBTPacketRe
/** previous redstone state for input/output, needed for state change detection */
public int lastState = 0;
/** last update tick, needed for receivers listening for changes */
protected long lastUpdate;
public long lastUpdate;
/** switches state change mode to tick-based polling */
public boolean polling = false;
/** switches redstone passthrough to custom signal mapping */
@ -29,6 +29,7 @@ public class TileEntityRadioTorchBase extends TileEntity implements INBTPacketRe
public void updateEntity() {
if(!worldObj.isRemote) {
NBTTagCompound data = new NBTTagCompound();
data.setBoolean("p", polling);
data.setBoolean("m", customMap);
@ -38,6 +39,28 @@ public class TileEntityRadioTorchBase extends TileEntity implements INBTPacketRe
}
}
@Override
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
this.polling = nbt.getBoolean("p");
this.customMap = nbt.getBoolean("m");
this.lastState = nbt.getInteger("l");
this.lastUpdate = nbt.getLong("u");
this.channel = nbt.getString("c");
for(int i = 0; i < 16; i++) this.mapping[i] = nbt.getString("m" + i);
}
@Override
public void writeToNBT(NBTTagCompound nbt) {
super.writeToNBT(nbt);
nbt.setBoolean("p", polling);
nbt.setBoolean("m", customMap);
nbt.setInteger("l", lastState);
nbt.setLong("u", lastUpdate);
if(channel != null) nbt.setString("c", channel);
for(int i = 0; i < 16; i++) if(mapping[i] != null) nbt.setString("m" + i, mapping[i]);
}
@Override
public void networkUnpack(NBTTagCompound nbt) {
this.polling = nbt.getBoolean("p");

View File

@ -15,7 +15,7 @@ public class TileEntityRadioTorchReceiver extends TileEntityRadioTorchBase {
RTTYChannel chan = RTTYSystem.listen(worldObj, this.channel);
if(chan != null && (this.polling || (chan.timeStamp != this.lastUpdate - 1 && chan.timeStamp != -1))) { // if we're either polling or a new message has come in
if(chan != null && (this.polling || (chan.timeStamp > this.lastUpdate - 1 && chan.timeStamp != -1))) { // if we're either polling or a new message has come in
String msg = "" + chan.signal;
this.lastUpdate = worldObj.getTotalWorldTime();
int nextState = 0; //if no remap apply, default to 0

View File

@ -1,5 +1,6 @@
package com.hbm.tileentity.network;
import net.minecraft.block.Block;
import net.minecraftforge.common.util.ForgeDirection;
public class TileEntityRadioTorchSender extends TileEntityRadioTorchBase {
@ -11,6 +12,12 @@ public class TileEntityRadioTorchSender extends TileEntityRadioTorchBase {
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata()).getOpposite();
int input = worldObj.getIndirectPowerLevelTo(xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ, this.getBlockMetadata());
Block b = worldObj.getBlock(xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ);
if(b.hasComparatorInputOverride()) {
input = b.getComparatorInputOverride(worldObj, xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ, dir.getOpposite().ordinal());
}
boolean shouldSend = this.polling;
if(input != this.lastState) {

View File

@ -373,6 +373,8 @@ container.reactorSmall=Atomreaktor
container.reix=Rei-X Hauptrechner
container.rtg=Radioisotopengenerator
container.rtgFurnace=RTG-Ofen
container.rttyReceiver=Redstone-over-Radio Empfänger
container.rttySender=Redstone-over-Radio Sender
container.safe=Panzerschrank
container.satDock=Frachtlandeplattform
container.satLinker=SatLink-Gerät
@ -3847,6 +3849,10 @@ tile.pribris.name=RBMK-Schutt
tile.pribris_burning.name=Flammender RBMK-Schutt
tile.pribris_digamma.name=Geschwärzter RBMK-Schutt
tile.pribris_radiating.name=Glühender RBMK-Schutt
tile.radio_torch_receiver.name=Redstone-over-Radio Empfänger
tile.radio_torch_receiver.desc=Kann auf ebenen Flächen oder Komparator-kompatiblen Blöcken platziert werden
tile.radio_torch_sender.name=Redstone-over-Radio Sender
tile.radio_torch_sender.desc=Kann auf ebenen Flächen oder Komparator-kompatiblen Blöcken platziert werden$Erkennt Redstone-Signale oder Komparator-Output
tile.radiobox.name=Rosenberg Ungeziefervernichter
tile.radiorec.name=Kaputtes UKW Radio
tile.rail_booster.name=Hochgeschwindigkeits-Boosterschienen

View File

@ -652,6 +652,8 @@ container.reactorResearch=Research Reactor
container.reix=Rei-X Mainframe
container.rtg=RT Generator
container.rtgFurnace=RTG Furnace
container.rttyReceiver=Redstone-over-Radio Receiver
container.rttySender=Redstone-over-Radio Transmitter
container.safe=Safe
container.satDock=Cargo Landing Pad
container.satLinker=SatLink Device
@ -4378,6 +4380,10 @@ tile.pribris.name=RBMK Debris
tile.pribris_burning.name=Flaming RBMK Debris
tile.pribris_digamma.name=Blackened RBMK Debris
tile.pribris_radiating.name=Smoldering RBMK Debris
tile.radio_torch_receiver.name=Redstone-over-Radio Receiver
tile.radio_torch_receiver.desc=Placable on flat surfaces or comparator-compatible blocks
tile.radio_torch_sender.name=Redstone-over-Radio Transmitter
tile.radio_torch_sender.desc=Placable on flat surfaces or comparator-compatible blocks$Reads redstone signals or comparator input
tile.radiobox.name=Rosenberg Pest Control Box
tile.radiorec.name=Broken FM Radio
tile.rail_booster.name=High Speed Booster Rail

Binary file not shown.

Before

Width:  |  Height:  |  Size: 191 B

After

Width:  |  Height:  |  Size: 188 B

View File

@ -3,7 +3,7 @@
"modid": "hbm",
"name": "Hbm's Nuclear Tech",
"description": "A mod that adds weapons, nuclear themed stuff and machines",
"version":"1.0.27_X4417",
"version":"1.0.27_X4431",
"mcversion": "1.7.10",
"url": "",
"updateUrl": "",