fixed colored concrete recipes, some solidifier code

removed the math question from the issue template because it didn't really achieve anything
This commit is contained in:
Boblet 2022-01-31 15:46:55 +01:00
parent 1c40dbbe1f
commit f4a2d72e5a
11 changed files with 276 additions and 20 deletions

View File

@ -10,7 +10,3 @@ assignees: ''
### Describe the bug ### Describe the bug
Please describe the issue in as much detail as possible. Also mention the version of the mod you're running, if it's not the newest. In the case of a crash, please attach a crash log. Please describe the issue in as much detail as possible. Also mention the version of the mod you're running, if it's not the newest. In the case of a crash, please attach a crash log.
### Please solve this equation to x
x²+3x-19=√(9x²)+6

View File

@ -6,7 +6,9 @@ import java.util.Random;
import com.hbm.handler.MultiblockHandlerXR; import com.hbm.handler.MultiblockHandlerXR;
import com.hbm.handler.ThreeInts; import com.hbm.handler.ThreeInts;
import com.hbm.main.MainRegistry;
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer; import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
@ -336,4 +338,20 @@ public abstract class BlockDummyable extends BlockContainer {
return 0; return 0;
} }
protected boolean standardOpenBehavior(World world, int x, int y, int z, EntityPlayer player, int id) {
if(world.isRemote) {
return true;
} else if(!player.isSneaking()) {
int[] pos = this.findCore(world, x, y, z);
if(pos == null)
return false;
FMLNetworkHandler.openGui(player, MainRegistry.instance, id, world, pos[0], pos[1], pos[2]);
return true;
} else {
return true;
}
}
} }

View File

@ -2063,6 +2063,7 @@ public class ModBlocks {
machine_deuterium_tower = new DeuteriumTower(Material.iron).setBlockName("machine_deuterium_tower").setHardness(10.0F).setResistance(20.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":concrete"); machine_deuterium_tower = new DeuteriumTower(Material.iron).setBlockName("machine_deuterium_tower").setHardness(10.0F).setResistance(20.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":concrete");
machine_liquefactor = new MachineLiquefactor().setBlockName("machine_liquefactor").setHardness(10.0F).setResistance(20.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel"); machine_liquefactor = new MachineLiquefactor().setBlockName("machine_liquefactor").setHardness(10.0F).setResistance(20.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
machine_solidifier = new MachineSolidifier().setBlockName("machine_solidifier").setHardness(10.0F).setResistance(20.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel_machine");
anvil_iron = new NTMAnvil(Material.iron, 1).setBlockName("anvil_iron").setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":anvil_iron"); anvil_iron = new NTMAnvil(Material.iron, 1).setBlockName("anvil_iron").setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":anvil_iron");
anvil_lead = new NTMAnvil(Material.iron, 1).setBlockName("anvil_lead").setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":anvil_lead"); anvil_lead = new NTMAnvil(Material.iron, 1).setBlockName("anvil_lead").setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":anvil_lead");
@ -2943,6 +2944,7 @@ public class ModBlocks {
GameRegistry.registerBlock(machine_deuterium_extractor, machine_deuterium_extractor.getUnlocalizedName()); GameRegistry.registerBlock(machine_deuterium_extractor, machine_deuterium_extractor.getUnlocalizedName());
GameRegistry.registerBlock(machine_deuterium_tower, machine_deuterium_tower.getUnlocalizedName()); GameRegistry.registerBlock(machine_deuterium_tower, machine_deuterium_tower.getUnlocalizedName());
GameRegistry.registerBlock(machine_liquefactor, ItemBlockBase.class, machine_liquefactor.getUnlocalizedName()); GameRegistry.registerBlock(machine_liquefactor, ItemBlockBase.class, machine_liquefactor.getUnlocalizedName());
GameRegistry.registerBlock(machine_solidifier, ItemBlockBase.class, machine_solidifier.getUnlocalizedName());
GameRegistry.registerBlock(machine_deaerator, machine_deaerator.getUnlocalizedName()); GameRegistry.registerBlock(machine_deaerator, machine_deaerator.getUnlocalizedName());
GameRegistry.registerBlock(machine_waste_drum, machine_waste_drum.getUnlocalizedName()); GameRegistry.registerBlock(machine_waste_drum, machine_waste_drum.getUnlocalizedName());
GameRegistry.registerBlock(machine_storage_drum, machine_storage_drum.getUnlocalizedName()); GameRegistry.registerBlock(machine_storage_drum, machine_storage_drum.getUnlocalizedName());

View File

@ -44,19 +44,7 @@ public class MachineLiquefactor extends BlockDummyable implements ITooltipProvid
@Override @Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
if(world.isRemote) { return this.standardOpenBehavior(world, x, y, z, player, 0);
return true;
} else if(!player.isSneaking()) {
int[] pos = this.findCore(world, x, y, z);
if(pos == null)
return false;
FMLNetworkHandler.openGui(player, MainRegistry.instance, 0, world, pos[0], pos[1], pos[2]);
return true;
} else {
return true;
}
} }
@Override @Override

View File

@ -0,0 +1,94 @@
package com.hbm.blocks.machine;
import java.util.List;
import org.lwjgl.input.Keyboard;
import com.hbm.blocks.BlockDummyable;
import com.hbm.blocks.ITooltipProvider;
import com.hbm.tileentity.TileEntityProxyCombo;
import com.hbm.tileentity.machine.TileEntityMachineSolidifier;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public class MachineSolidifier extends BlockDummyable implements ITooltipProvider {
public MachineSolidifier() {
super(Material.iron);
}
@Override
public TileEntity createNewTileEntity(World world, int meta) {
if(meta >= 12)
return new TileEntityMachineSolidifier();
if(meta >= extra)
return new TileEntityProxyCombo(true, true, true);
return null;
}
@Override
public int[] getDimensions() {
return new int[] {3, 0, 1, 1, 1, 1};
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
return this.standardOpenBehavior(world, x, y, z, player, 0);
}
@Override
public int getOffset() {
return 1;
}
@Override
public void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) {
super.fillSpace(world, x, y, z, dir, o);
x = x + dir.offsetX * o;
z = z + dir.offsetZ * o;
this.makeExtra(world, x, y + 3, z);
this.makeExtra(world, x + 1, y + 1, z);
this.makeExtra(world, x - 1, y + 1, z);
this.makeExtra(world, x, y + 1, z + 1);
this.makeExtra(world, x, y + 1, z - 1);
}
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean ext) {
if(Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
list.add(EnumChatFormatting.YELLOW + "beb");
} else {
list.add(EnumChatFormatting.DARK_GRAY + "" + EnumChatFormatting.ITALIC +"Hold <" +
EnumChatFormatting.YELLOW + "" + EnumChatFormatting.ITALIC + "LSHIFT" +
EnumChatFormatting.DARK_GRAY + "" + EnumChatFormatting.ITALIC + "> to display more info");
}
}
@Override
public int getRenderType() {
return 0;
}
@Override
public boolean isOpaqueCube() {
return true;
}
@Override
public boolean renderAsNormalBlock() {
return true;
}
}

View File

@ -0,0 +1,42 @@
package com.hbm.inventory.recipes;
import static com.hbm.inventory.fluid.Fluids.*;
import java.util.HashMap;
import com.hbm.inventory.FluidStack;
import com.hbm.inventory.OreDictManager.DictFrame;
import com.hbm.inventory.fluid.FluidType;
import com.hbm.items.ItemEnums.EnumTarType;
import com.hbm.items.ModItems;
import com.hbm.util.Tuple.Pair;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
public class SolidificationRecipes {
private static HashMap<FluidType, Pair<Integer, ItemStack>> recipes = new HashMap();
public static void register() {
registerRecipe(WATER, 1000, Blocks.ice);
registerRecipe(LAVA, 1000, Blocks.obsidian);
//temporary recipes with incorrect quantities
registerRecipe(OIL, 1000, DictFrame.fromOne(ModItems.oil_tar, EnumTarType.CRUDE));
registerRecipe(BITUMEN, 1000, DictFrame.fromOne(ModItems.oil_tar, EnumTarType.CRUDE));
registerRecipe(HEATINGOIL, 1000, ModItems.solid_fuel);
}
private static void registerRecipe(FluidType type, int quantity, Item output) { registerRecipe(type, quantity, new ItemStack(output)); }
private static void registerRecipe(FluidType type, int quantity, Block output) { registerRecipe(type, quantity, new ItemStack(output)); }
private static void registerRecipe(FluidType type, int quantity, ItemStack output) {
recipes.put(type, new Pair<Integer, ItemStack>(quantity, output));
}
public static Pair<Integer, ItemStack> getOutput(FluidType type) {
return recipes.get(type);
}
}

View File

@ -377,9 +377,10 @@ public class CraftingManager {
addShapelessAuto(new ItemStack(ModBlocks.asphalt, 1), new Object[] { ModBlocks.asphalt_light }); addShapelessAuto(new ItemStack(ModBlocks.asphalt, 1), new Object[] { ModBlocks.asphalt_light });
addRecipeAuto(new ItemStack(ModBlocks.block_niter_reinforced, 1), new Object[] { "TCT", "CNC", "TCT", 'T', TCALLOY.ingot(), 'C', ModBlocks.concrete, 'N', KNO.block() }); addRecipeAuto(new ItemStack(ModBlocks.block_niter_reinforced, 1), new Object[] { "TCT", "CNC", "TCT", 'T', TCALLOY.ingot(), 'C', ModBlocks.concrete, 'N', KNO.block() });
String[] dyes = { "Black", "Red", "Green", "Brown", "Blue", "Purple", "Cyan", "LightGray", "Gray", "Pink", "Lime", "Yellow", "LightBlue", "Magenta", "Orange", "White" };
for(int i = 0; i < 16; i++) { for(int i = 0; i < 16; i++) {
String dyeName = ItemDye.field_150923_a[15 - i]; String dyeName = "dye" + dyes[15 - i];
dyeName = "dye" + dyeName.substring(0, 1).toUpperCase() + dyeName.substring(1);
addRecipeAuto(new ItemStack(ModBlocks.concrete_colored, 8, i), new Object[] { "CCC", "CDC", "CCC", 'C', ModBlocks.concrete_smooth, 'D', dyeName }); addRecipeAuto(new ItemStack(ModBlocks.concrete_colored, 8, i), new Object[] { "CCC", "CDC", "CCC", 'C', ModBlocks.concrete_smooth, 'D', dyeName });
addRecipeAuto(new ItemStack(ModBlocks.concrete_colored, 8, i), new Object[] { "CCC", "CDC", "CCC", 'C', ModBlocks.concrete_colored, 'D', dyeName }); addRecipeAuto(new ItemStack(ModBlocks.concrete_colored, 8, i), new Object[] { "CCC", "CDC", "CCC", 'C', ModBlocks.concrete_colored, 'D', dyeName });
} }

View File

@ -115,7 +115,8 @@ public class TileEntityMachineLiquefactor extends TileEntityMachineBase implemen
this.markDirty(); this.markDirty();
} }
} }
@Override
public void networkUnpack(NBTTagCompound nbt) { public void networkUnpack(NBTTagCompound nbt) {
this.power = nbt.getLong("power"); this.power = nbt.getLong("power");
this.progress = nbt.getInteger("progress"); this.progress = nbt.getInteger("progress");

View File

@ -0,0 +1,114 @@
package com.hbm.tileentity.machine;
import com.hbm.inventory.FluidTank;
import com.hbm.inventory.fluid.Fluids;
import com.hbm.inventory.recipes.LiquefactionRecipes;
import com.hbm.inventory.recipes.SolidificationRecipes;
import com.hbm.lib.Library;
import com.hbm.tileentity.TileEntityMachineBase;
import api.hbm.energy.IEnergyUser;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
public class TileEntityMachineSolidifier extends TileEntityMachineBase implements IEnergyUser {
public long power;
public static final long maxPower = 100000;
public static final int usage = 500;
public int progress;
public static final int processTime = 200;
public FluidTank tank;
public TileEntityMachineSolidifier() {
super(5);
tank = new FluidTank(Fluids.NONE, 24000, 0);
}
@Override
public String getName() {
return "container.machineSolidifier";
}
@Override
public void updateEntity() {
if(!worldObj.isRemote) {
this.power = Library.chargeTEFromItems(slots, 1, power, maxPower);
tank.updateTank(this);
this.trySubscribe(worldObj, xCoord + 2, yCoord + 1, zCoord, Library.POS_X);
this.trySubscribe(worldObj, xCoord - 2, yCoord + 1, zCoord, Library.NEG_X);
this.trySubscribe(worldObj, xCoord, yCoord + 1, zCoord + 2, Library.POS_Z);
this.trySubscribe(worldObj, xCoord, yCoord + 1, zCoord - 2, Library.NEG_Z);
NBTTagCompound data = new NBTTagCompound();
data.setLong("power", this.power);
data.setInteger("progress", this.progress);
this.networkPack(data, 50);
}
}
@Override
public void networkUnpack(NBTTagCompound nbt) {
this.power = nbt.getLong("power");
this.progress = nbt.getInteger("progress");
}
@Override
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
tank.readFromNBT(nbt, "tank");
}
@Override
public void writeToNBT(NBTTagCompound nbt) {
super.writeToNBT(nbt);
tank.writeToNBT(nbt, "tank");
}
@Override
public void setPower(long power) {
this.power = power;
}
@Override
public long getPower() {
return power;
}
@Override
public long getMaxPower() {
return maxPower;
}
AxisAlignedBB bb = null;
@Override
public AxisAlignedBB getRenderBoundingBox() {
if(bb == null) {
bb = AxisAlignedBB.getBoundingBox(
xCoord - 1,
yCoord,
zCoord - 1,
xCoord + 2,
yCoord + 4,
zCoord + 2
);
}
return bb;
}
@Override
@SideOnly(Side.CLIENT)
public double getMaxRenderDistanceSquared() {
return 65536.0D;
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB