Blast fishing, fish bombing, dynamite fishing or grenade fishing is a de

structive fishing practice using explosives to stun or kill schools of fish for easy collection.
This commit is contained in:
Boblet 2023-05-24 14:35:43 +02:00
parent be5c4ba9d6
commit 305b7232f2
18 changed files with 263 additions and 121 deletions

View File

@ -348,6 +348,7 @@ public class WeaponRecipes {
//Sticks of explosives
CraftingManager.addRecipeAuto(new ItemStack(ModItems.stick_dynamite, 4), new Object[] { " S ", "PDP", "PDP", 'S', ModItems.safety_fuse, 'P', Items.paper, 'D', ModItems.ball_dynamite });
CraftingManager.addShapelessAuto(new ItemStack(ModItems.stick_dynamite_fishing, 1), new Object[] { ModItems.stick_dynamite, ModItems.stick_dynamite, ModItems.stick_dynamite, Items.paper, ANY_TAR.any() });
CraftingManager.addRecipeAuto(new ItemStack(ModItems.stick_tnt, 4), new Object[] { " S ", "PDP", "PDP", 'S', ModBlocks.det_cord, 'P', Items.paper, 'D', ModItems.ball_tnt });
CraftingManager.addRecipeAuto(new ItemStack(ModItems.stick_semtex, 4), new Object[] { " S ", "PDP", "PDP", 'S', ModBlocks.det_cord, 'P', Items.paper, 'D', ModItems.ingot_semtex });
CraftingManager.addRecipeAuto(new ItemStack(ModItems.stick_c4, 4), new Object[] { " S ", "PDP", "PDP", 'S', ModBlocks.det_cord, 'P', Items.paper, 'D', ModItems.ingot_c4 });

View File

@ -40,7 +40,7 @@ public class EntityGrenadeBouncyGeneric extends EntityGrenadeBouncyBase implemen
@Override
public void explode() {
getGrenade().explode(worldObj, posX, posY, posZ);
getGrenade().explode(this, this.getThrower(), worldObj, posX, posY, posZ);
this.setDead();
}

View File

@ -42,7 +42,7 @@ public class EntityGrenadeImpactGeneric extends EntityGrenadeBase implements IGe
public void explode() {
if(!this.worldObj.isRemote && getGrenade() != null) {
getGrenade().explode(worldObj, posX, posY, posZ);
getGrenade().explode(this, this.getThrower(), worldObj, posX, posY, posZ);
this.setDead();
}
}

View File

@ -68,30 +68,6 @@ public class EntityRBMKDebris extends EntityDebrisBase {
hasSizeSet = true;
}
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
this.motionY -= 0.04D;
this.moveEntity(this.motionX, this.motionY, this.motionZ);
this.lastRot = this.rot;
if(this.onGround) {
this.motionX *= 0.85D;
this.motionZ *= 0.85D;
this.motionY *= -0.5D;
} else {
this.rot += 10F;
if(rot >= 360F) {
this.rot -= 360F;
this.lastRot -= 360F;
}
}
if(!worldObj.isRemote) {
if(this.getType() == DebrisType.LID && motionY > 0) {
@ -133,6 +109,30 @@ public class EntityRBMKDebris extends EntityDebrisBase {
if(!RBMKDials.getPermaScrap(worldObj) && this.ticksExisted > getLifetime() + this.getEntityId() % 50)
this.setDead();
}
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
this.motionY -= 0.04D;
this.moveEntity(this.motionX, this.motionY, this.motionZ);
this.lastRot = this.rot;
if(this.onGround) {
this.motionX *= 0.85D;
this.motionZ *= 0.85D;
this.motionY *= -0.5D;
} else {
this.rot += 10F;
if(rot >= 360F) {
this.rot -= 360F;
this.lastRot -= 360F;
}
}
}
@Override

View File

@ -132,6 +132,7 @@ public class Fluids {
public static FluidType ESTRADIOL;
public static FluidType FISHOIL;
public static FluidType SUNFLOWEROIL;
public static FluidType NITROGLYCERIN;
private static final HashMap<Integer, FluidType> idMapping = new HashMap();
private static final HashMap<String, FluidType> nameMapping = new HashMap();
@ -274,7 +275,8 @@ public class Fluids {
CHOLESTEROL = new FluidType("CHOLESTEROL", 0xD6D2BD, 0, 0, 0, EnumSymbol.NONE).addTraits(LIQUID);
ESTRADIOL = new FluidType("ESTRADIOL", 0xCDD5D8, 0, 0, 0, EnumSymbol.NONE).addTraits(LIQUID);
FISHOIL = new FluidType("FISHOIL", 0x4B4A45, 0, 1, 0, EnumSymbol.NONE).addTraits(LIQUID);
SUNFLOWEROIL = new FluidType(111, "SUNFLOWEROIL", 0xCBAD45, 0, 1, 0, EnumSymbol.NONE).addTraits(LIQUID);
SUNFLOWEROIL = new FluidType("SUNFLOWEROIL", 0xCBAD45, 0, 1, 0, EnumSymbol.NONE).addTraits(LIQUID);
NITROGLYCERIN = new FluidType(112, "SUNFLOWEROIL", 0xCBAD45, 0, 4, 0, EnumSymbol.NONE).addTraits(LIQUID);
// ^ ^ ^ ^ ^ ^ ^ ^
//ADD NEW FLUIDS HERE
@ -390,6 +392,7 @@ public class Fluids {
metaOrder.add(PHOSGENE);
metaOrder.add(MUSTARDGAS);
metaOrder.add(ESTRADIOL);
metaOrder.add(NITROGLYCERIN);
//antimatter
metaOrder.add(AMAT);
metaOrder.add(ASCHRAB);

View File

@ -1,14 +1,26 @@
package com.hbm.inventory.gui;
import java.util.ArrayList;
import java.util.List;
import org.lwjgl.opengl.GL11;
import com.hbm.inventory.container.ContainerMixer;
import com.hbm.inventory.recipes.MixerRecipes;
import com.hbm.inventory.recipes.MixerRecipes.MixerRecipe;
import com.hbm.lib.RefStrings;
import com.hbm.packet.AuxButtonPacket;
import com.hbm.packet.NBTControlPacket;
import com.hbm.packet.PacketDispatcher;
import com.hbm.tileentity.machine.TileEntityMachineMixer;
import com.hbm.util.I18nUtil;
import net.minecraft.client.Minecraft;
import net.minecraft.client.audio.PositionedSoundRecord;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.ResourceLocation;
public class GUIMixer extends GuiInfoContainer {
@ -29,12 +41,38 @@ public class GUIMixer extends GuiInfoContainer {
super.drawScreen(x, y, interp);
this.drawElectricityInfo(this, x, y, guiLeft + 23, guiTop + 23, 16, 52, mixer.getPower(), mixer.getMaxPower());
MixerRecipe[] recipes = MixerRecipes.getOutput(mixer.tanks[2].getTankType());
if(recipes != null && recipes.length > 1) {
List<String> label = new ArrayList();
label.add(EnumChatFormatting.YELLOW + "Current recipe (" + (mixer.recipeIndex + 1) + "/" + recipes.length + "):");
MixerRecipe recipe = recipes[mixer.recipeIndex % recipes.length];
if(recipe.input1 != null) label.add("-" + I18nUtil.resolveKey(recipe.input1.type.getUnlocalizedName()));
if(recipe.input2 != null) label.add("-" + I18nUtil.resolveKey(recipe.input2.type.getUnlocalizedName()));
if(recipe.solidInput != null) label.add("-" + recipe.solidInput.extractForCyclingDisplay(20).getDisplayName());
label.add(EnumChatFormatting.RED + "Click to change!");
this.drawCustomInfoStat(x, y, guiLeft + 62, guiTop + 22, 12, 12, x, y, label);
}
mixer.tanks[0].renderTankInfo(this, x, y, guiLeft + 43, guiTop + 23, 7, 52);
mixer.tanks[1].renderTankInfo(this, x, y, guiLeft + 52, guiTop + 23, 7, 52);
mixer.tanks[2].renderTankInfo(this, x, y, guiLeft + 117, guiTop + 23, 16, 52);
}
@Override
protected void mouseClicked(int x, int y, int i) {
super.mouseClicked(x, y, i);
if(guiLeft + 62 <= x && guiLeft + 62 + 12 > x && guiTop + 22 < y && guiTop + 22 + 12 >= y) {
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
NBTTagCompound data = new NBTTagCompound();
data.setBoolean("toggle", true);
PacketDispatcher.wrapper.sendToServer(new NBTControlPacket(data, mixer.xCoord, mixer.yCoord, mixer.zCoord));
}
}
@Override
protected void drawGuiContainerForegroundLayer( int i, int j) {

View File

@ -50,7 +50,7 @@ public class CokerRecipes extends SerializableRecipe {
registerAuto(AROMATICS, GAS_COKER);
registerAuto(REFORMATE, GAS_COKER);
registerAuto(XYLENE, GAS_COKER);
registerAuto(FISHOIL, NAPHTHA_COKER);
registerAuto(FISHOIL, MERCURY);
registerAuto(SUNFLOWEROIL, GAS_COKER);
registerSFAuto(WOODOIL, 340_000L, new ItemStack(Items.coal, 1, 1), GAS_COKER);

View File

@ -127,13 +127,15 @@ public class CrystallizerRecipes extends SerializableRecipe {
registerRecipe(new ComparableStack(ModItems.ore_nitrocrystalline, 1, i), new CrystallizerRecipe(new ItemStack(ModItems.ore_seared, 1, i), oreTime), hiperf);
}
FluidStack woodOil = new FluidStack(Fluids.WOODOIL, 100);
registerRecipe(COAL.dust(), new CrystallizerRecipe(DictFrame.fromOne(ModItems.chemical_dye, EnumChemDye.BLACK, 4), 20), woodOil);
registerRecipe(TI.dust(), new CrystallizerRecipe(DictFrame.fromOne(ModItems.chemical_dye, EnumChemDye.WHITE, 4), 20), woodOil);
registerRecipe(IRON.dust(), new CrystallizerRecipe(DictFrame.fromOne(ModItems.chemical_dye, EnumChemDye.RED, 4), 20), woodOil);
registerRecipe(W.dust(), new CrystallizerRecipe(DictFrame.fromOne(ModItems.chemical_dye, EnumChemDye.YELLOW, 4), 20), woodOil);
registerRecipe(CU.dust(), new CrystallizerRecipe(DictFrame.fromOne(ModItems.chemical_dye, EnumChemDye.GREEN, 4), 20), woodOil);
registerRecipe(CO.dust(), new CrystallizerRecipe(DictFrame.fromOne(ModItems.chemical_dye, EnumChemDye.BLUE, 4), 20), woodOil);
FluidStack[] dyes = new FluidStack[] {new FluidStack(Fluids.WOODOIL, 100), new FluidStack(Fluids.FISHOIL, 100)};
for(FluidStack dye : dyes) {
registerRecipe(COAL.dust(), new CrystallizerRecipe(DictFrame.fromOne(ModItems.chemical_dye, EnumChemDye.BLACK, 4), 20), dye);
registerRecipe(TI.dust(), new CrystallizerRecipe(DictFrame.fromOne(ModItems.chemical_dye, EnumChemDye.WHITE, 4), 20), dye);
registerRecipe(IRON.dust(), new CrystallizerRecipe(DictFrame.fromOne(ModItems.chemical_dye, EnumChemDye.RED, 4), 20), dye);
registerRecipe(W.dust(), new CrystallizerRecipe(DictFrame.fromOne(ModItems.chemical_dye, EnumChemDye.YELLOW, 4), 20), dye);
registerRecipe(CU.dust(), new CrystallizerRecipe(DictFrame.fromOne(ModItems.chemical_dye, EnumChemDye.GREEN, 4), 20), dye);
registerRecipe(CO.dust(), new CrystallizerRecipe(DictFrame.fromOne(ModItems.chemical_dye, EnumChemDye.BLUE, 4), 20), dye);
}
registerRecipe(new ComparableStack(DictFrame.fromOne(ModItems.oil_tar, EnumTarType.CRUDE)), new CrystallizerRecipe(DictFrame.fromOne(ModItems.oil_tar, EnumTarType.WAX), 20), new FluidStack(Fluids.CHLORINE, 250));
registerRecipe(new ComparableStack(DictFrame.fromOne(ModItems.oil_tar, EnumTarType.CRACK)), new CrystallizerRecipe(DictFrame.fromOne(ModItems.oil_tar, EnumTarType.WAX), 20), new FluidStack(Fluids.CHLORINE, 100));

View File

@ -8,6 +8,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map.Entry;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.stream.JsonWriter;
@ -27,67 +28,72 @@ import net.minecraftforge.oredict.OreDictionary;
public class MixerRecipes extends SerializableRecipe {
public static HashMap<FluidType, MixerRecipe> recipes = new HashMap();
public static HashMap<FluidType, MixerRecipe[]> recipes_experimental = new HashMap();
public static HashMap<FluidType, MixerRecipe[]> recipes = new HashMap();
@Override
public void registerDefaults() {
recipes.put(Fluids.COOLANT, new MixerRecipe(2_000, 50).setStack1(new FluidStack(Fluids.WATER, 1_800)).setSolid(new OreDictStack(KNO.dust())));
recipes.put(Fluids.CRYOGEL, new MixerRecipe(2_000, 50).setStack1(new FluidStack(Fluids.COOLANT, 1_800)).setSolid(new ComparableStack(ModItems.powder_ice)));
recipes.put(Fluids.NITAN, new MixerRecipe(1_000, 50).setStack1(new FluidStack(Fluids.KEROSENE, 600)).setStack2(new FluidStack(Fluids.MERCURY, 200)).setSolid(new ComparableStack(ModItems.powder_nitan_mix)));
recipes.put(Fluids.FRACKSOL, new MixerRecipe(1_000, 20).setStack1(new FluidStack(Fluids.SULFURIC_ACID, 900)).setStack2(new FluidStack(Fluids.PETROLEUM, 100)));
recipes.put(Fluids.ENDERJUICE, new MixerRecipe(100, 100).setStack1(new FluidStack(Fluids.XPJUICE, 500)).setSolid(new OreDictStack(DIAMOND.dust())));
recipes.put(Fluids.SALIENT, new MixerRecipe(1000, 20).setStack1(new FluidStack(Fluids.SEEDSLURRY, 500)).setStack2(new FluidStack(Fluids.BLOOD, 500)));
recipes.put(Fluids.COLLOID, new MixerRecipe(500, 20).setStack1(new FluidStack(Fluids.WATER, 500)).setSolid(new ComparableStack(ModItems.dust)));
recipes.put(Fluids.PHOSGENE, new MixerRecipe(1000, 20).setStack1(new FluidStack(Fluids.UNSATURATEDS, 500)).setStack2(new FluidStack(Fluids.CHLORINE, 500)));
recipes.put(Fluids.MUSTARDGAS, new MixerRecipe(1000, 20).setStack1(new FluidStack(Fluids.REFORMGAS, 750)).setStack2(new FluidStack(Fluids.CHLORINE, 250)).setSolid(new OreDictStack(S.dust())));
recipes.put(Fluids.IONGEL, new MixerRecipe(1_000, 50).setStack1(new FluidStack(Fluids.WATER, 1000)).setStack2(new FluidStack(Fluids.HYDROGEN, 200)).setSolid(new ComparableStack(ModItems.pellet_charged)));
recipes.put(Fluids.EGG, new MixerRecipe(1_000, 50).setStack1(new FluidStack(Fluids.RADIOSOLVENT, 500)).setSolid(new ComparableStack(Items.egg)));
recipes.put(Fluids.FISHOIL, new MixerRecipe(100, 50).setSolid(new ComparableStack(Items.fish, 1, OreDictionary.WILDCARD_VALUE)));
recipes.put(Fluids.SUNFLOWEROIL, new MixerRecipe(100, 50).setSolid(new ComparableStack(Blocks.double_plant, 1, 0)));
register(Fluids.COOLANT, new MixerRecipe(2_000, 50).setStack1(new FluidStack(Fluids.WATER, 1_800)).setSolid(new OreDictStack(KNO.dust())));
register(Fluids.CRYOGEL, new MixerRecipe(2_000, 50).setStack1(new FluidStack(Fluids.COOLANT, 1_800)).setSolid(new ComparableStack(ModItems.powder_ice)));
register(Fluids.NITAN, new MixerRecipe(1_000, 50).setStack1(new FluidStack(Fluids.KEROSENE, 600)).setStack2(new FluidStack(Fluids.MERCURY, 200)).setSolid(new ComparableStack(ModItems.powder_nitan_mix)));
register(Fluids.FRACKSOL,
new MixerRecipe(1_000, 20).setStack1(new FluidStack(Fluids.SULFURIC_ACID, 900)).setStack2(new FluidStack(Fluids.PETROLEUM, 100)),
new MixerRecipe(1_000, 20).setStack1(new FluidStack(Fluids.WATER, 1000)).setStack2(new FluidStack(Fluids.PETROLEUM, 100)).setSolid(new OreDictStack(S.dust())));
register(Fluids.ENDERJUICE, new MixerRecipe(100, 100).setStack1(new FluidStack(Fluids.XPJUICE, 500)).setSolid(new OreDictStack(DIAMOND.dust())));
register(Fluids.SALIENT, new MixerRecipe(1000, 20).setStack1(new FluidStack(Fluids.SEEDSLURRY, 500)).setStack2(new FluidStack(Fluids.BLOOD, 500)));
register(Fluids.COLLOID, new MixerRecipe(500, 20).setStack1(new FluidStack(Fluids.WATER, 500)).setSolid(new ComparableStack(ModItems.dust)));
register(Fluids.PHOSGENE, new MixerRecipe(1000, 20).setStack1(new FluidStack(Fluids.UNSATURATEDS, 500)).setStack2(new FluidStack(Fluids.CHLORINE, 500)));
register(Fluids.MUSTARDGAS, new MixerRecipe(1000, 20).setStack1(new FluidStack(Fluids.REFORMGAS, 750)).setStack2(new FluidStack(Fluids.CHLORINE, 250)).setSolid(new OreDictStack(S.dust())));
register(Fluids.IONGEL, new MixerRecipe(1_000, 50).setStack1(new FluidStack(Fluids.WATER, 1000)).setStack2(new FluidStack(Fluids.HYDROGEN, 200)).setSolid(new ComparableStack(ModItems.pellet_charged)));
register(Fluids.EGG, new MixerRecipe(1_000, 50).setStack1(new FluidStack(Fluids.RADIOSOLVENT, 500)).setSolid(new ComparableStack(Items.egg)));
register(Fluids.FISHOIL, new MixerRecipe(100, 50).setSolid(new ComparableStack(Items.fish, 1, OreDictionary.WILDCARD_VALUE)));
register(Fluids.SUNFLOWEROIL, new MixerRecipe(100, 50).setSolid(new ComparableStack(Blocks.double_plant, 1, 0)));
recipes.put(Fluids.SOLVENT, new MixerRecipe(1000, 50).setStack1(new FluidStack(Fluids.NAPHTHA, 500)).setStack2(new FluidStack(Fluids.AROMATICS, 500)));
recipes.put(Fluids.SULFURIC_ACID, new MixerRecipe(500, 50).setStack1(new FluidStack(Fluids.ACID, 800)).setSolid(new OreDictStack(S.dust())));
recipes.put(Fluids.NITRIC_ACID, new MixerRecipe(500, 50).setStack1(new FluidStack(Fluids.SULFURIC_ACID, 500)).setSolid(new OreDictStack(KNO.dust())));
recipes.put(Fluids.RADIOSOLVENT, new MixerRecipe(1000, 50).setStack1(new FluidStack(Fluids.REFORMGAS, 750)).setStack2(new FluidStack(Fluids.CHLORINE, 250)));
recipes.put(Fluids.SCHRABIDIC, new MixerRecipe(16_000, 100).setStack1(new FluidStack(Fluids.SAS3, 8_000)).setStack2(new FluidStack(Fluids.ACID, 6_000)).setSolid(new ComparableStack(ModItems.pellet_charged)));
register(Fluids.SOLVENT, new MixerRecipe(1000, 50).setStack1(new FluidStack(Fluids.NAPHTHA, 500)).setStack2(new FluidStack(Fluids.AROMATICS, 500)));
register(Fluids.SULFURIC_ACID, new MixerRecipe(500, 50).setStack1(new FluidStack(Fluids.ACID, 800)).setSolid(new OreDictStack(S.dust())));
register(Fluids.NITRIC_ACID, new MixerRecipe(500, 50).setStack1(new FluidStack(Fluids.SULFURIC_ACID, 500)).setSolid(new OreDictStack(KNO.dust())));
register(Fluids.RADIOSOLVENT, new MixerRecipe(1000, 50).setStack1(new FluidStack(Fluids.REFORMGAS, 750)).setStack2(new FluidStack(Fluids.CHLORINE, 250)));
register(Fluids.SCHRABIDIC, new MixerRecipe(16_000, 100).setStack1(new FluidStack(Fluids.SAS3, 8_000)).setStack2(new FluidStack(Fluids.ACID, 6_000)).setSolid(new ComparableStack(ModItems.pellet_charged)));
recipes.put(Fluids.LUBRICANT, new MixerRecipe(1_000, 20).setStack1(new FluidStack(Fluids.HEATINGOIL, 500)).setStack2(new FluidStack(Fluids.UNSATURATEDS, 500)));
recipes.put(Fluids.PETROIL, new MixerRecipe(1_000, 30).setStack1(new FluidStack(Fluids.RECLAIMED, 800)).setStack2(new FluidStack(Fluids.LUBRICANT, 200)));
register(Fluids.PETROIL, new MixerRecipe(1_000, 30).setStack1(new FluidStack(Fluids.RECLAIMED, 800)).setStack2(new FluidStack(Fluids.LUBRICANT, 200)));
register(Fluids.LUBRICANT,
new MixerRecipe(1_000, 20).setStack1(new FluidStack(Fluids.HEATINGOIL, 500)).setStack2(new FluidStack(Fluids.UNSATURATEDS, 500)),
new MixerRecipe(1_000, 20).setStack1(new FluidStack(Fluids.FISHOIL, 800)).setStack2(new FluidStack(Fluids.ETHANOL, 200)),
new MixerRecipe(1_000, 20).setStack1(new FluidStack(Fluids.SUNFLOWEROIL, 800)).setStack2(new FluidStack(Fluids.ETHANOL, 200)));
register(Fluids.BIOFUEL,
new MixerRecipe(250, 20).setStack1(new FluidStack(Fluids.FISHOIL, 500)).setStack2(new FluidStack(Fluids.WOODOIL, 500)),
new MixerRecipe(200, 20).setStack1(new FluidStack(Fluids.SUNFLOWEROIL, 500)).setStack2(new FluidStack(Fluids.WOODOIL, 500)));
register(Fluids.NITROGLYCERIN,
new MixerRecipe(1000, 20).setStack1(new FluidStack(Fluids.PETROLEUM, 1_000)).setStack2(new FluidStack(Fluids.NITRIC_ACID, 1_000)),
new MixerRecipe(1000, 20).setStack1(new FluidStack(Fluids.FISHOIL, 500)).setStack2(new FluidStack(Fluids.NITRIC_ACID, 500)));
recipes.put(Fluids.SYNGAS, new MixerRecipe(1_000, 50).setStack1(new FluidStack(Fluids.COALOIL, 500)).setStack2(new FluidStack(Fluids.STEAM, 500)));
recipes.put(Fluids.OXYHYDROGEN, new MixerRecipe(1_000, 50).setStack1(new FluidStack(Fluids.HYDROGEN, 500)).setStack2(new FluidStack(Fluids.OXYGEN, 500)));
register(Fluids.SYNGAS, new MixerRecipe(1_000, 50).setStack1(new FluidStack(Fluids.COALOIL, 500)).setStack2(new FluidStack(Fluids.STEAM, 500)));
register(Fluids.OXYHYDROGEN, new MixerRecipe(1_000, 50).setStack1(new FluidStack(Fluids.HYDROGEN, 500)).setStack2(new FluidStack(Fluids.OXYGEN, 500)));
recipes.put(Fluids.PETROIL_LEADED, new MixerRecipe(12_000, 40).setStack1(new FluidStack(Fluids.PETROIL, 10_000)).setSolid(new ComparableStack(ModItems.antiknock)));
recipes.put(Fluids.GASOLINE_LEADED, new MixerRecipe(12_000, 40).setStack1(new FluidStack(Fluids.GASOLINE, 10_000)).setSolid(new ComparableStack(ModItems.antiknock)));
recipes.put(Fluids.COALGAS_LEADED, new MixerRecipe(12_000, 40).setStack1(new FluidStack(Fluids.COALGAS, 10_000)).setSolid(new ComparableStack(ModItems.antiknock)));
register(Fluids.PETROIL_LEADED, new MixerRecipe(12_000, 40).setStack1(new FluidStack(Fluids.PETROIL, 10_000)).setSolid(new ComparableStack(ModItems.antiknock)));
register(Fluids.GASOLINE_LEADED, new MixerRecipe(12_000, 40).setStack1(new FluidStack(Fluids.GASOLINE, 10_000)).setSolid(new ComparableStack(ModItems.antiknock)));
register(Fluids.COALGAS_LEADED, new MixerRecipe(12_000, 40).setStack1(new FluidStack(Fluids.COALGAS, 10_000)).setSolid(new ComparableStack(ModItems.antiknock)));
recipes.put(Fluids.DIESEL_REFORM, new MixerRecipe(1_000, 50).setStack1(new FluidStack(Fluids.DIESEL, 900)).setStack2(new FluidStack(Fluids.REFORMATE, 100)));
recipes.put(Fluids.DIESEL_CRACK_REFORM, new MixerRecipe(1_000, 50).setStack1(new FluidStack(Fluids.DIESEL_CRACK, 900)).setStack2(new FluidStack(Fluids.REFORMATE, 100)));
recipes.put(Fluids.KEROSENE_REFORM, new MixerRecipe(1_000, 50).setStack1(new FluidStack(Fluids.KEROSENE, 900)).setStack2(new FluidStack(Fluids.REFORMATE, 100)));
register(Fluids.DIESEL_REFORM, new MixerRecipe(1_000, 50).setStack1(new FluidStack(Fluids.DIESEL, 900)).setStack2(new FluidStack(Fluids.REFORMATE, 100)));
register(Fluids.DIESEL_CRACK_REFORM, new MixerRecipe(1_000, 50).setStack1(new FluidStack(Fluids.DIESEL_CRACK, 900)).setStack2(new FluidStack(Fluids.REFORMATE, 100)));
register(Fluids.KEROSENE_REFORM, new MixerRecipe(1_000, 50).setStack1(new FluidStack(Fluids.KEROSENE, 900)).setStack2(new FluidStack(Fluids.REFORMATE, 100)));
}
public static void registerExperimental(FluidType type, MixerRecipe... recipes) {
recipes_experimental.put(type, recipes);
public static void register(FluidType type, MixerRecipe... rec) {
recipes.put(type, rec);
}
public static MixerRecipe[] getOutputExperimental(FluidType type) {
return recipes_experimental.get(type);
public static MixerRecipe[] getOutput(FluidType type) {
return recipes.get(type);
}
public static MixerRecipe getOutputExperimental(FluidType type, int index) {
MixerRecipe[] recs = recipes_experimental.get(type);
public static MixerRecipe getOutput(FluidType type, int index) {
MixerRecipe[] recs = recipes.get(type);
if(recs == null) return null;
return recs[index % recs.length];
}
public static MixerRecipe getOutput(FluidType type) {
return recipes.get(type);
}
@Override
public String getFileName() {
return "hbmMixer.json";
@ -107,57 +113,53 @@ public class MixerRecipes extends SerializableRecipe {
public void readRecipe(JsonElement recipe) {
JsonObject obj = (JsonObject) recipe;
FluidStack output = this.readFluidStack(obj.get("output").getAsJsonArray());
MixerRecipe mix = new MixerRecipe(output.fill, obj.get("duration").getAsInt());
if(obj.has("input1")) mix.setStack1(this.readFluidStack(obj.get("input1").getAsJsonArray()));
if(obj.has("input2")) mix.setStack2(this.readFluidStack(obj.get("input2").getAsJsonArray()));
if(obj.has("solidInput")) mix.setSolid(this.readAStack(obj.get("solidInput").getAsJsonArray()));
FluidType outputType = Fluids.fromName(obj.get("outputType").getAsString());
JsonArray recipeArray = obj.get("recipes").getAsJsonArray();
MixerRecipe[] array = new MixerRecipe[recipeArray.size()];
recipes.put(output.type, mix);
for(int i = 0; i < recipeArray.size(); i++) {
JsonObject sub = recipeArray.get(i).getAsJsonObject();
MixerRecipe mix = new MixerRecipe(sub.get("outputAmount").getAsInt(), sub.get("duration").getAsInt());
if(sub.has("input1")) mix.setStack1(this.readFluidStack(sub.get("input1").getAsJsonArray()));
if(sub.has("input2")) mix.setStack2(this.readFluidStack(sub.get("input2").getAsJsonArray()));
if(sub.has("solidInput")) mix.setSolid(this.readAStack(sub.get("solidInput").getAsJsonArray()));
array[i] = mix;
}
recipes.put(outputType, array);
}
@Override
public void writeRecipe(Object recipe, JsonWriter writer) throws IOException {
Entry<FluidType, MixerRecipe> rec = (Entry<FluidType, MixerRecipe>) recipe;
MixerRecipe mix = rec.getValue();
FluidStack output = new FluidStack(rec.getKey(), mix.output);
Entry<FluidType, MixerRecipe[]> rec = (Entry<FluidType, MixerRecipe[]>) recipe;
MixerRecipe[] recipes = rec.getValue();
writer.name("duration").value(mix.processTime);
writer.name("output");
this.writeFluidStack(output, writer);
writer.name("outputType").value(rec.getKey().getName());
writer.name("recipes").beginArray();
if(mix.input1 != null) { writer.name("input1"); this.writeFluidStack(mix.input1, writer); }
if(mix.input2 != null) { writer.name("input2"); this.writeFluidStack(mix.input2, writer); }
if(mix.solidInput != null) { writer.name("solidInput"); this.writeAStack(mix.solidInput, writer); }
for(MixerRecipe mix : recipes) {
writer.beginObject();
FluidStack output = new FluidStack(rec.getKey(), mix.output);
writer.name("duration").value(mix.processTime);
writer.name("outputAmount").value(mix.output);
if(mix.input1 != null) { writer.name("input1"); this.writeFluidStack(mix.input1, writer); }
if(mix.input2 != null) { writer.name("input2"); this.writeFluidStack(mix.input2, writer); }
if(mix.solidInput != null) { writer.name("solidInput"); this.writeAStack(mix.solidInput, writer); }
writer.endObject();
}
writer.endArray();
}
public static HashMap getRecipes() {
HashMap<Object[], Object> recipes = new HashMap<Object[], Object>();
for(Entry<FluidType, MixerRecipe> entry : MixerRecipes.recipes.entrySet()) {
FluidType type = entry.getKey();
MixerRecipe recipe = entry.getValue();
FluidStack output = new FluidStack(type, recipe.output);
List<Object> objects = new ArrayList();
if(recipe.input1 != null) objects.add(ItemFluidIcon.make(recipe.input1));
if(recipe.input2 != null) objects.add(ItemFluidIcon.make(recipe.input2));
if(recipe.solidInput != null) objects.add(recipe.solidInput);
recipes.put(objects.toArray(), ItemFluidIcon.make(output));
}
return recipes;
}
public static HashMap getRecipesExperimental() {
HashMap<Object[], Object> recipes = new HashMap<Object[], Object>();
for(Entry<FluidType, MixerRecipe[]> entry : MixerRecipes.recipes_experimental.entrySet()) {
for(Entry<FluidType, MixerRecipe[]> entry : MixerRecipes.recipes.entrySet()) {
FluidType type = entry.getKey();
MixerRecipe[] recs = entry.getValue();

View File

@ -1613,6 +1613,7 @@ public class ModItems {
public static Item crucible;
public static Item stick_dynamite;
public static Item stick_dynamite_fishing;
public static Item stick_tnt;
public static Item stick_semtex;
public static Item stick_c4;
@ -4220,6 +4221,7 @@ public class ModItems {
crucible = new ItemCrucible(5000, 1F, matCrucible).setUnlocalizedName("crucible").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":crucible");
stick_dynamite = new ItemGrenade(3).setUnlocalizedName("stick_dynamite").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":stick_dynamite");
stick_dynamite_fishing = new ItemGrenadeFishing(3).setUnlocalizedName("stick_dynamite_fishing").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":stick_dynamite_fishing");
stick_tnt = new Item().setUnlocalizedName("stick_tnt").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":stick_tnt");
stick_semtex = new Item().setUnlocalizedName("stick_semtex").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":stick_semtex");
stick_c4 = new Item().setUnlocalizedName("stick_c4").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":stick_c4");

View File

@ -3,6 +3,8 @@ package com.hbm.items.weapon;
import com.hbm.entity.grenade.EntityGrenadeBouncyGeneric;
import com.hbm.entity.grenade.EntityGrenadeImpactGeneric;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
@ -33,7 +35,7 @@ public class ItemGenericGrenade extends ItemGrenade {
return stack;
}
public void explode(World world, double x, double y, double z) { }
public void explode(Entity grenade, EntityLivingBase thrower, World world, double x, double y, double z) { }
public int getMaxTimer() {
return this.fuse * 20;

View File

@ -0,0 +1,59 @@
package com.hbm.items.weapon;
import java.util.Random;
import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
public class ItemGrenadeFishing extends ItemGenericGrenade {
public ItemGrenadeFishing(int fuse) {
super(fuse);
}
@Override
public void explode(Entity grenade, EntityLivingBase thrower, World world, double x, double y, double z) {
world.newExplosion(null, x, y + 0.25D, z, 3F, false, false);
int iX = (int) Math.floor(x);
int iY = (int) Math.floor(y);
int iZ = (int) Math.floor(z);
for(int i = 0; i < 15; i++) {
int rX = iX + world.rand.nextInt(15) - 7;
int rY = iY + world.rand.nextInt(15) - 7;
int rZ = iZ + world.rand.nextInt(15) - 7;
if(world.getBlock(rX, rY, rZ).getMaterial() == Material.water) {
ItemStack loot = this.getRandomLoot(world.rand);
if(loot != null) {
EntityItem item = new EntityItem(world, rX + 0.5, rY + 0.5, rZ + 0.5, loot.copy());
item.motionY = 3;
world.spawnEntityInWorld(item);
}
}
}
}
public static ItemStack getRandomLoot(Random rand) {
float chance = rand.nextFloat();
int luck = 0;
int speed = 100; //reduces both the junk and treasure chance to near zero
return net.minecraftforge.common.FishingHooks.getRandomFishable(rand, chance, luck, speed);
}
@Override
public int getMaxTimer() {
return 60;
}
@Override
public double getBounceMod() {
return 0.5D;
}
}

View File

@ -1,5 +1,6 @@
package com.hbm.tileentity.machine;
import com.hbm.interfaces.IControlReceiver;
import com.hbm.inventory.UpgradeManager;
import com.hbm.inventory.container.ContainerMixer;
import com.hbm.inventory.fluid.Fluids;
@ -26,12 +27,13 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
public class TileEntityMachineMixer extends TileEntityMachineBase implements INBTPacketReceiver, IGUIProvider, IEnergyUser, IFluidStandardTransceiver {
public class TileEntityMachineMixer extends TileEntityMachineBase implements INBTPacketReceiver, IControlReceiver, IGUIProvider, IEnergyUser, IFluidStandardTransceiver {
public long power;
public static final long maxPower = 10_000;
public int progress;
public int processTime;
public int recipeIndex;
public float rotation;
public float prevRotation;
@ -107,6 +109,7 @@ public class TileEntityMachineMixer extends TileEntityMachineBase implements INB
data.setLong("power", power);
data.setInteger("processTime", processTime);
data.setInteger("progress", progress);
data.setInteger("recipe", recipeIndex);
data.setBoolean("wasOn", wasOn);
for(int i = 0; i < 3; i++) {
tanks[i].writeToNBT(data, i + "");
@ -133,6 +136,7 @@ public class TileEntityMachineMixer extends TileEntityMachineBase implements INB
this.power = nbt.getLong("power");
this.processTime = nbt.getInteger("processTime");
this.progress = nbt.getInteger("progress");
this.recipeIndex = nbt.getInteger("recipe");
this.wasOn = nbt.getBoolean("wasOn");
for(int i = 0; i < 3; i++) {
tanks[i].readFromNBT(nbt, i + "");
@ -140,10 +144,19 @@ public class TileEntityMachineMixer extends TileEntityMachineBase implements INB
}
public boolean canProcess() {
MixerRecipe[] recipes = MixerRecipes.getOutput(tanks[2].getTankType());
if(recipes == null || recipes.length <= 0) {
this.recipeIndex = 0;
return false;
}
MixerRecipe recipe = MixerRecipes.getOutput(tanks[2].getTankType());
if(recipe == null) return false;
this.recipeIndex = this.recipeIndex % recipes.length;
MixerRecipe recipe = recipes[this.recipeIndex];
if(recipe == null) {
this.recipeIndex = 0;
return false;
}
tanks[0].setTankType(recipe.input1 != null ? recipe.input1.type : Fluids.NONE);
tanks[1].setTankType(recipe.input2 != null ? recipe.input2.type : Fluids.NONE);
@ -169,7 +182,8 @@ public class TileEntityMachineMixer extends TileEntityMachineBase implements INB
protected void process() {
MixerRecipe recipe = MixerRecipes.getOutput(tanks[2].getTankType());
MixerRecipe[] recipes = MixerRecipes.getOutput(tanks[2].getTankType());
MixerRecipe recipe = recipes[this.recipeIndex % recipes.length];
if(recipe.input1 != null) tanks[0].setFill(tanks[0].getFill() - recipe.input1.fill);
if(recipe.input2 != null) tanks[1].setFill(tanks[1].getFill() - recipe.input2.fill);
@ -199,8 +213,10 @@ public class TileEntityMachineMixer extends TileEntityMachineBase implements INB
@Override
public boolean isItemValidForSlot(int i, ItemStack itemStack) {
MixerRecipe recipe = MixerRecipes.getOutput(tanks[2].getTankType());
MixerRecipe[] recipes = MixerRecipes.getOutput(tanks[2].getTankType());
if(recipes == null || recipes.length <= 0) return false;
MixerRecipe recipe = recipes[this.recipeIndex % recipes.length];
if(recipe == null || recipe.solidInput == null) return false;
return recipe.solidInput.matchesRecipe(itemStack, true);
@ -213,6 +229,7 @@ public class TileEntityMachineMixer extends TileEntityMachineBase implements INB
this.power = nbt.getLong("power");
this.progress = nbt.getInteger("progress");
this.processTime = nbt.getInteger("processTime");
this.recipeIndex = nbt.getInteger("recipe");
for(int i = 0; i < 3; i++) this.tanks[i].readFromNBT(nbt, i + "");
}
@ -223,6 +240,7 @@ public class TileEntityMachineMixer extends TileEntityMachineBase implements INB
nbt.setLong("power", power);
nbt.setInteger("progress", progress);
nbt.setInteger("processTime", processTime);
nbt.setInteger("recipe", recipeIndex);
for(int i = 0; i < 3; i++) this.tanks[i].writeToNBT(nbt, i + "");
}
@ -284,4 +302,15 @@ public class TileEntityMachineMixer extends TileEntityMachineBase implements INB
public double getMaxRenderDistanceSquared() {
return 65536.0D;
}
@Override
public boolean hasPermission(EntityPlayer player) {
return player.getDistance(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5) <= 16;
}
@Override
public void receiveControl(NBTTagCompound data) {
if(data.hasKey("toggle")) this.recipeIndex++;
}
}

View File

@ -659,6 +659,7 @@ hbmfluid.naphtha_coker=Koker-Naphtha
hbmfluid.naphtha_crack=Crack-Mitteldestillat
hbmfluid.nitan=NITAN© 100 Oktan Supertreibstoff
hbmfluid.nitric_acid=Salpetersäure
hbmfluid.nitroglycerin=Nitroglycerin
hbmfluid.none=Nichts
hbmfluid.oil=Rohöl
hbmfluid.oil_coker=Koker-Öl
@ -3097,6 +3098,7 @@ item.steel_shovel.name=Stahlschaufel
item.steel_sword.name=Stahlschwert
item.stick_c4.name=Stange C4
item.stick_dynamite.name=Stange Dynamit
item.stick_dynamite_fishing.name=Stange Fischerei-Dynamit
item.stick_semtex.name=Stange Semtex
item.stick_tnt.name=Stange TNT
item.stopsign.name=Stopschild-Streitaxt

View File

@ -1231,6 +1231,7 @@ hbmfluid.naphtha_coker=Coker Naphtha
hbmfluid.naphtha_crack=Cracked Naphtha
hbmfluid.nitan=NITAN© 100 Octane Super Fuel
hbmfluid.nitric_acid=Nitric Acid
hbmfluid.nitroglycerin=Nitroglycerin
hbmfluid.none=None
hbmfluid.oil=Crude Oil
hbmfluid.oil_coker=Coker Oil
@ -3882,6 +3883,7 @@ item.steel_shovel.name=Steel Shovel
item.steel_sword.name=Steel Sword
item.stick_c4.name=Stick of C-4
item.stick_dynamite.name=Stick of Dynamite
item.stick_dynamite_fishing.name=Stick of Fishing Dynamite
item.stick_semtex.name=Stick of Semtex
item.stick_tnt.name=Stick of TNT
item.stopsign.name=Stop Sign Battle Axe

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 215 B