*neko ark noises*

This commit is contained in:
HbmMods 2026-08-01 19:27:34 +02:00
parent 7c2b6a0201
commit c382c92350
7 changed files with 447 additions and 4 deletions

View File

@ -5,6 +5,7 @@ import com.hbm.tileentity.TileEntityProxyCombo;
import com.hbm.tileentity.machine.TileEntityMachineRockMill; import com.hbm.tileentity.machine.TileEntityMachineRockMill;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
@ -22,6 +23,11 @@ public class MachineRockMill extends BlockDummyable {
return null; return null;
} }
@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[] getDimensions() { return new int[] {2, 0, 2, 2, 2, 2}; } @Override public int[] getDimensions() { return new int[] {2, 0, 2, 2, 2, 2}; }
@Override public int getOffset() { return 2; } @Override public int getOffset() { return 2; }

View File

@ -440,7 +440,7 @@ public class OreDictManager {
HEMATITE .ore(fromOne(stone_resource, EnumStoneType.HEMATITE)); HEMATITE .ore(fromOne(stone_resource, EnumStoneType.HEMATITE));
MALACHITE .ingot(DictFrame.fromOne(chunk_ore, EnumChunkType.MALACHITE)) .ore(fromOne(stone_resource, EnumStoneType.MALACHITE)); MALACHITE .ingot(DictFrame.fromOne(chunk_ore, EnumChunkType.MALACHITE)) .ore(fromOne(stone_resource, EnumStoneType.MALACHITE));
LIMESTONE .dust(powder_limestone) .ore(fromOne(stone_resource, EnumStoneType.LIMESTONE)); LIMESTONE .dust(powder_limestone) .ore(fromOne(stone_resource, EnumStoneType.LIMESTONE));
BAUXITE .gem(fromOne(stone_resource, EnumStoneType.BAUXITE)); BAUXITE .ore(fromOne(stone_resource, EnumStoneType.BAUXITE));
CRYOLITE .crystal(fromOne(chunk_ore, EnumChunkType.CRYOLITE)); CRYOLITE .crystal(fromOne(chunk_ore, EnumChunkType.CRYOLITE));
SLAG .block(block_slag); SLAG .block(block_slag);

View File

@ -0,0 +1,69 @@
package com.hbm.inventory.container;
import com.hbm.inventory.SlotCraftingOutput;
import com.hbm.inventory.SlotNonRetarded;
import com.hbm.items.ModItems;
import com.hbm.items.machine.ItemBlueprints;
import com.hbm.util.InventoryUtil;
import api.hbm.energymk2.IBatteryItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
public class ContainerMachineRockMill extends ContainerBase {
public ContainerMachineRockMill(InventoryPlayer invPlayer, IInventory rockMill) {
super(invPlayer, rockMill);
// Battery
this.addSlotToContainer(new SlotNonRetarded(rockMill, 0, 152, 91));
// Schematic
this.addSlotToContainer(new SlotNonRetarded(rockMill, 1, 35, 90));
// Solid Input
this.addSlots(rockMill, 2, 8, 27, 1, 3);
// Solid Output
this.addOutputSlots(invPlayer.player, rockMill, 5, 80, 27, 1, 3);
this.playerInv(invPlayer, 8, 138);
}
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int index) {
ItemStack slotOriginal = null;
Slot slot = (Slot) this.inventorySlots.get(index);
if(slot != null && slot.getHasStack()) {
ItemStack slotStack = slot.getStack();
slotOriginal = slotStack.copy();
if(index <= tile.getSizeInventory() - 1) {
SlotCraftingOutput.checkAchievements(player, slotStack);
if(!this.mergeItemStack(slotStack, tile.getSizeInventory(), this.inventorySlots.size(), true)) {
return null;
}
} else {
if(slotOriginal.getItem() instanceof IBatteryItem || slotOriginal.getItem() == ModItems.battery_creative) {
if(!this.mergeItemStack(slotStack, 0, 1, false)) return null;
} else if(slotOriginal.getItem() instanceof ItemBlueprints) {
if(!this.mergeItemStack(slotStack, 1, 2, false)) return null;
} else {
if(!InventoryUtil.mergeItemStack(this.inventorySlots, slotStack, 2, 5, false)) return null;
}
}
if(slotStack.stackSize == 0) {
slot.putStack(null);
} else {
slot.onSlotChanged();
}
slot.onPickupFromSlot(player, slotStack);
}
return slotOriginal;
}
}

View File

@ -0,0 +1,124 @@
package com.hbm.inventory.gui;
import org.lwjgl.opengl.GL11;
import com.hbm.inventory.container.ContainerMachineRockMill;
import com.hbm.inventory.gui.element.GUIElements;
import com.hbm.inventory.recipes.RockMillRecipes;
import com.hbm.inventory.recipes.loader.GenericRecipe;
import com.hbm.items.machine.ItemBlueprints;
import com.hbm.lib.RefStrings;
import com.hbm.tileentity.machine.TileEntityMachineRockMill;
import com.hbm.util.i18n.I18nUtil;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.ResourceLocation;
public class GUIMachineRockMill extends GuiInfoContainer {
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/processing/gui_rockmill.png");
private TileEntityMachineRockMill rockMill;
public GUIMachineRockMill(InventoryPlayer invPlayer, TileEntityMachineRockMill tedf) {
super(new ContainerMachineRockMill(invPlayer, tedf));
rockMill = tedf;
this.xSize = 176;
this.ySize = 220;
}
@Override
public void drawScreen(int mouseX, int mouseY, float f) {
super.drawScreen(mouseX, mouseY, f);
rockMill.inputTanks[0].renderTankInfo(this, mouseX, mouseY, guiLeft + 8, guiTop + 63, 52, 16);
rockMill.outputTanks[0].renderTankInfo(this, mouseX, mouseY, guiLeft + 80, guiTop + 63, 52, 16);
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 152, guiTop + 18, 16, 71, rockMill.power, rockMill.maxPower);
if(guiLeft + 7 <= mouseX && guiLeft + 7 + 18 > mouseX && guiTop + 89 < mouseY && guiTop + 89 + 18 >= mouseY) {
if(this.rockMill.rockMillModule.getRecipe() != null) {
GenericRecipe recipe = this.rockMill.rockMillModule.getRecipe();
GUIElements.drawHoveringTextRecipe(recipe.print(), mouseX, mouseY, this.fontRendererObj, itemRender, this.width, this.height);
} else {
this.drawCreativeTabHoveringText(EnumChatFormatting.YELLOW + I18nUtil.resolveKey("gui.recipe.setRecipe"), mouseX, mouseY);
}
}
}
@Override
protected void mouseClicked(int x, int y, int button) {
super.mouseClicked(x, y, button);
if(this.checkClick(x, y, 7, 89, 18, 18)) GUIScreenRecipeSelector.openSelector(RockMillRecipes.INSTANCE, rockMill, rockMill.rockMillModule.getRecipeName(), 0, ItemBlueprints.grabPool(rockMill.slots[1]), this);
}
@Override
protected void drawGuiContainerForegroundLayer(int i, int j) {
String name = this.rockMill.hasCustomInventoryName() ? this.rockMill.getInventoryName() : I18n.format(this.rockMill.getInventoryName());
this.fontRendererObj.drawString(name, 70 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
}
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
int p = (int) (rockMill.power * 71 / rockMill.maxPower);
drawTexturedModalRect(guiLeft + 152, guiTop + 89 - p, 176, 71 - p, 16, p);
if(rockMill.rockMillModule.progress > 0) {
int j = (int) Math.ceil(70 * rockMill.rockMillModule.progress);
drawTexturedModalRect(guiLeft + 62, guiTop + 90, 176, 71, j, 16);
}
GenericRecipe recipe = rockMill.rockMillModule.getRecipe();
/// LEFT LED
if(rockMill.didProcess) {
drawTexturedModalRect(guiLeft + 51, guiTop + 85, 195, 0, 3, 6);
} else if(recipe != null) {
drawTexturedModalRect(guiLeft + 51, guiTop + 85, 192, 0, 3, 6);
}
/// RIGHT LED
if(rockMill.didProcess) {
drawTexturedModalRect(guiLeft + 56, guiTop + 85, 195, 0, 3, 6);
} else if(recipe != null && rockMill.power >= recipe.power) {
drawTexturedModalRect(guiLeft + 56, guiTop + 85, 192, 0, 3, 6);
}
this.renderItem(recipe != null ? recipe.getIcon() : TEMPLATE_FOLDER, 8, 90);
if(recipe != null && recipe.inputItem != null) {
for(int i = 0; i < recipe.inputItem.length; i++) {
Slot slot = (Slot) this.inventorySlots.inventorySlots.get(rockMill.rockMillModule.inputSlots[i]);
if(!slot.getHasStack()) this.renderItem(recipe.inputItem[i].extractForCyclingDisplay(20), slot.xDisplayPosition, slot.yDisplayPosition, 10F);
}
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
GL11.glColor4f(1F, 1F, 1F, 0.5F);
GL11.glEnable(GL11.GL_BLEND);
this.zLevel = 300F;
for(int i = 0; i < recipe.inputItem.length; i++) {
Slot slot = (Slot) this.inventorySlots.inventorySlots.get(rockMill.rockMillModule.inputSlots[i]);
if(!slot.getHasStack()) drawTexturedModalRect(guiLeft + slot.xDisplayPosition, guiTop + slot.yDisplayPosition, slot.xDisplayPosition, slot.yDisplayPosition, 16, 16);
}
this.zLevel = 0F;
GL11.glColor4f(1F, 1F, 1F, 1F);
GL11.glDisable(GL11.GL_BLEND);
}
rockMill.inputTanks[0].renderTank(guiLeft + 8, guiTop + 79, this.zLevel, 52, 16, 1);
rockMill.outputTanks[0].renderTank(guiLeft + 80, guiTop + 79, this.zLevel, 52, 16, 1);
}
}

View File

@ -1,7 +1,19 @@
package com.hbm.inventory.recipes; package com.hbm.inventory.recipes;
import static com.hbm.inventory.OreDictManager.*;
import com.hbm.blocks.ModBlocks;
import com.hbm.inventory.FluidStack;
import com.hbm.inventory.RecipesCommon.ComparableStack;
import com.hbm.inventory.RecipesCommon.OreDictStack;
import com.hbm.inventory.fluid.Fluids;
import com.hbm.inventory.recipes.loader.GenericRecipe; import com.hbm.inventory.recipes.loader.GenericRecipe;
import com.hbm.inventory.recipes.loader.GenericRecipes; import com.hbm.inventory.recipes.loader.GenericRecipes;
import com.hbm.items.ModItems;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
public class RockMillRecipes extends GenericRecipes<GenericRecipe> { public class RockMillRecipes extends GenericRecipes<GenericRecipe> {
@ -17,6 +29,36 @@ public class RockMillRecipes extends GenericRecipes<GenericRecipe> {
@Override @Override
public void registerDefaults() { public void registerDefaults() {
// TBI
int consumption = 25;
int duraShort = 100;
int duraLong = 200;
this.register(new GenericRecipe("rock.cobble").setupNamed(duraShort, consumption).setNameWrapper("rock.crushing")
.inputItems(new OreDictStack(KEY_COBBLESTONE))
.inputFluids(new FluidStack(Fluids.WATER, 250))
.outputItems(new ChanceOutputMulti(
new ChanceOutput(new ItemStack(Blocks.gravel), 95),
new ChanceOutput(new ItemStack(ModItems.powder_quartz), 5)
)).setIconToFirstIngredient());
this.register(new GenericRecipe("rock.gravel").setupNamed(duraShort, consumption).setNameWrapper("rock.crushing")
.inputItems(new ComparableStack(Blocks.gravel))
.inputFluids(new FluidStack(Fluids.WATER, 250))
.outputItems(new ChanceOutputMulti(
new ChanceOutput(new ItemStack(Blocks.sand), 75),
new ChanceOutput(new ItemStack(Items.flint), 20),
new ChanceOutput(new ItemStack(ModItems.powder_boron), 5)
)).setIconToFirstIngredient());
this.register(new GenericRecipe("rock.bauxite").setupNamed(duraLong, consumption).setNameWrapper("rock.crushing")
.inputItems(new OreDictStack(BAUXITE.ore()))
.inputFluids(new FluidStack(Fluids.WATER, 250))
.outputItems(new ChanceOutputMulti(
new ChanceOutput(new ItemStack(Blocks.gravel), 25),
new ChanceOutput(new ItemStack(Items.clay_ball), 25),
new ChanceOutput(new ItemStack(ModBlocks.stone_resource, 1, 2), 25),
new ChanceOutput(new ItemStack(ModBlocks.ore_titanium, 1, 2), 25)
)).setIconToFirstIngredient());
} }
} }

View File

@ -96,6 +96,7 @@ public abstract class SerializableRecipe {
recipeHandlers.add(PrecAssRecipes.INSTANCE); recipeHandlers.add(PrecAssRecipes.INSTANCE);
recipeHandlers.add(PlasmaForgeRecipes.INSTANCE); recipeHandlers.add(PlasmaForgeRecipes.INSTANCE);
recipeHandlers.add(BlastFurnaceRecipesNT.INSTANCE); recipeHandlers.add(BlastFurnaceRecipesNT.INSTANCE);
recipeHandlers.add(RockMillRecipes.INSTANCE);
recipeHandlers.add(new MatDistribution()); recipeHandlers.add(new MatDistribution());
recipeHandlers.add(new CustomMachineRecipes()); recipeHandlers.add(new CustomMachineRecipes());

View File

@ -1,16 +1,65 @@
package com.hbm.tileentity.machine; package com.hbm.tileentity.machine;
import com.hbm.interfaces.IControlReceiver;
import com.hbm.inventory.container.ContainerMachineRockMill;
import com.hbm.inventory.fluid.Fluids;
import com.hbm.inventory.fluid.tank.FluidTank;
import com.hbm.inventory.gui.GUIMachineRockMill;
import com.hbm.inventory.recipes.loader.GenericRecipe;
import com.hbm.items.ModItems;
import com.hbm.lib.Library;
import com.hbm.module.machine.ModuleMachineRockMill;
import com.hbm.tileentity.IGUIProvider;
import com.hbm.tileentity.TileEntityMachineBase; import com.hbm.tileentity.TileEntityMachineBase;
import com.hbm.util.BobMathUtil;
import com.hbm.util.fauxpointtwelve.DirPos;
public class TileEntityMachineRockMill extends TileEntityMachineBase { import api.hbm.energymk2.IBatteryItem;
import api.hbm.energymk2.IEnergyReceiverMK2;
import api.hbm.fluidmk2.IFluidStandardTransceiverMK2;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import io.netty.buffer.ByteBuf;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
public class TileEntityMachineRockMill extends TileEntityMachineBase implements IEnergyReceiverMK2, IFluidStandardTransceiverMK2, IControlReceiver, IGUIProvider {
public FluidTank[] inputTanks;
public FluidTank[] outputTanks;
public long power;
public long maxPower = 2_500;
public boolean didProcess = false;
public float rotation; public float rotation;
public float prevRotation; public float prevRotation;
public float rotationSpeed = 0F;
public static final float ACCELERATION = 0.1F;
public static final float MAX_SPEED = 15F;
public boolean frame = false; public boolean frame = false;
public ModuleMachineRockMill rockMillModule;
public TileEntityMachineRockMill() { public TileEntityMachineRockMill() {
super(0); super(8);
this.inputTanks = new FluidTank[1];
this.outputTanks = new FluidTank[1];
this.inputTanks[0] = new FluidTank(Fluids.NONE, 4_000);
this.outputTanks[0] = new FluidTank(Fluids.NONE, 4_000);
this.rockMillModule = new ModuleMachineRockMill(0, this, slots)
.itemInput(2).itemOutput(5)
.fluidInput(inputTanks[0]).fluidOutput(outputTanks[0]);
} }
@Override @Override
@ -21,13 +70,165 @@ public class TileEntityMachineRockMill extends TileEntityMachineBase {
@Override @Override
public void updateEntity() { public void updateEntity() {
if(maxPower <= 0) this.maxPower = 2_500;
if(!worldObj.isRemote) { if(!worldObj.isRemote) {
GenericRecipe recipe = rockMillModule.getRecipe();
if(recipe != null) {
this.maxPower = recipe.power * 100;
}
this.maxPower = BobMathUtil.max(this.power, this.maxPower, 1_000_000);
this.power = Library.chargeTEFromItems(slots, 0, power, maxPower);
for(DirPos pos : getConPos()) {
this.trySubscribe(worldObj, pos);
for(FluidTank tank : inputTanks) if(tank.getTankType() != Fluids.NONE) this.trySubscribe(tank.getTankType(), worldObj, pos);
for(FluidTank tank : outputTanks) if(tank.getFill() > 0) this.tryProvide(tank, worldObj, pos);
}
this.rockMillModule.update(1D, 1D, true, slots[1]);
this.didProcess = this.rockMillModule.didProcess;
if(this.rockMillModule.markDirty) this.markDirty();
this.networkPackNT(100);
} else { } else {
this.prevRotation = this.rotation;
this.rotationSpeed += this.ACCELERATION * (this.didProcess ? 1 : -1);
this.rotationSpeed = MathHelper.clamp_float(this.rotationSpeed, 0F, MAX_SPEED);
this.rotation += this.rotationSpeed;
if(this.rotation >= 360F) {
this.prevRotation -= 360F;
this.rotation -= 360F;
}
if(worldObj.getTotalWorldTime() % 20 == 0) { if(worldObj.getTotalWorldTime() % 20 == 0) {
frame = !worldObj.getBlock(xCoord, yCoord + 3, zCoord).isAir(worldObj, xCoord, yCoord + 3, zCoord); frame = !worldObj.getBlock(xCoord, yCoord + 3, zCoord).isAir(worldObj, xCoord, yCoord + 3, zCoord);
} }
} }
} }
public DirPos[] getConPos() {
return new DirPos[] {
new DirPos(xCoord + 3, yCoord, zCoord + 1, Library.POS_X),
new DirPos(xCoord + 3, yCoord, zCoord - 1, Library.POS_X),
new DirPos(xCoord - 3, yCoord, zCoord + 1, Library.NEG_X),
new DirPos(xCoord - 3, yCoord, zCoord - 1, Library.NEG_X),
new DirPos(xCoord + 1, yCoord, zCoord + 3, Library.POS_Z),
new DirPos(xCoord - 1, yCoord, zCoord + 3, Library.POS_Z),
new DirPos(xCoord + 1, yCoord, zCoord - 3, Library.NEG_Z),
new DirPos(xCoord - 1, yCoord, zCoord - 3, Library.NEG_Z),
};
}
@Override
public void serialize(ByteBuf buf) {
super.serialize(buf);
for(FluidTank tank : inputTanks) tank.serialize(buf);
for(FluidTank tank : outputTanks) tank.serialize(buf);
buf.writeLong(power);
buf.writeLong(maxPower);
buf.writeBoolean(didProcess);
this.rockMillModule.serialize(buf);
}
@Override
public void deserialize(ByteBuf buf) {
super.deserialize(buf);
for(FluidTank tank : inputTanks) tank.deserialize(buf);
for(FluidTank tank : outputTanks) tank.deserialize(buf);
this.power = buf.readLong();
this.maxPower = buf.readLong();
this.didProcess = buf.readBoolean();
this.rockMillModule.deserialize(buf);
}
@Override
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
this.inputTanks[0].readFromNBT(nbt, "i" + 0);
this.outputTanks[0].readFromNBT(nbt, "o" + 0);
this.power = nbt.getLong("power");
this.maxPower = nbt.getLong("maxPower");
this.rockMillModule.readFromNBT(nbt);
}
@Override
public void writeToNBT(NBTTagCompound nbt) {
super.writeToNBT(nbt);
this.inputTanks[0].writeToNBT(nbt, "i" + 0);
this.outputTanks[0].writeToNBT(nbt, "o" + 0);
nbt.setLong("power", power);
nbt.setLong("maxPower", maxPower);
this.rockMillModule.writeToNBT(nbt);
}
@Override
public boolean isItemValidForSlot(int slot, ItemStack stack) {
if(slot == 0) return stack.getItem() instanceof IBatteryItem; // battery
if(slot == 1 && stack.getItem() == ModItems.blueprints) return true;
if(this.rockMillModule.isItemValid(slot, stack)) return true; // recipe input crap
return false;
}
@Override
public boolean canExtractItem(int i, ItemStack itemStack, int j) {
return (i >= 5 && i <= 7) || this.rockMillModule.isSlotClogged(i);
}
@Override
public int[] getAccessibleSlotsFromSide(int side) {
return new int[] {2, 3, 4, 5, 6, 7};
}
@Override public long getPower() { return power; }
@Override public void setPower(long power) { this.power = power; }
@Override public long getMaxPower() { return maxPower; }
@Override public FluidTank[] getReceivingTanks() { return inputTanks; }
@Override public FluidTank[] getSendingTanks() { return outputTanks; }
@Override public FluidTank[] getAllTanks() { return new FluidTank[] {inputTanks[0], outputTanks[0]}; }
@Override public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) { return new ContainerMachineRockMill(player.inventory, this); }
@Override @SideOnly(Side.CLIENT) public Object provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) { return new GUIMachineRockMill(player.inventory, this); }
@Override public boolean hasPermission(EntityPlayer player) { return this.isUseableByPlayer(player); }
@Override
public void receiveControl(NBTTagCompound data) {
if(data.hasKey("index") && data.hasKey("selection")) {
int index = data.getInteger("index");
String selection = data.getString("selection");
if(index == 0) {
this.rockMillModule.setRecipe(selection, false);
this.markChanged();
}
}
}
AxisAlignedBB bb = null;
@Override
public AxisAlignedBB getRenderBoundingBox() {
if(bb == null) bb = AxisAlignedBB.getBoundingBox(xCoord - 2, yCoord, zCoord - 2, xCoord + 3, yCoord + 3, zCoord + 3);
return bb;
}
@Override
@SideOnly(Side.CLIENT)
public double getMaxRenderDistanceSquared() {
return 65536.0D;
}
} }