old ideas: go

This commit is contained in:
Boblet 2026-05-18 16:36:20 +02:00
parent 9ce969edb3
commit feaff0c91a
11 changed files with 2245 additions and 27 deletions

View File

@ -976,6 +976,7 @@ public class ModBlocks {
public static Block machine_ore_slopper;
public static Block machine_annihilator;
public static Block machine_autosaw;
public static Block machine_thresher;
public static Block machine_mining_laser;
public static Block barricade; // a sand bag that drops nothing, for automated walling purposes
@ -2192,6 +2193,7 @@ public class ModBlocks {
machine_coker = new MachineCoker(Material.iron).setBlockName("machine_coker").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
machine_pyrooven = new MachinePyroOven(Material.iron).setBlockName("machine_pyrooven").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
machine_autosaw = new MachineAutosaw().setBlockName("machine_autosaw").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
machine_thresher = new MachineThresher().setBlockName("machine_thresher").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
machine_excavator = new MachineExcavator().setBlockName("machine_excavator").setHardness(5.0F).setResistance(100.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
machine_ore_slopper = new MachineOreSlopper().setBlockName("machine_ore_slopper").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
machine_annihilator = new MachineAnnihilator().setBlockName("machine_annihilator").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
@ -3292,6 +3294,7 @@ public class ModBlocks {
register(machine_coker);
register(machine_pyrooven);
register(machine_autosaw);
register(machine_thresher);
register(machine_excavator);
register(machine_ore_slopper);
register(machine_annihilator);

View File

@ -34,20 +34,9 @@ public class MachineAutosaw extends BlockContainer implements ILookOverlay, IToo
return new TileEntityMachineAutosaw();
}
@Override
public int getRenderType() {
return -1;
}
@Override
public boolean isOpaqueCube() {
return false;
}
@Override
public boolean renderAsNormalBlock() {
return false;
}
@Override public int getRenderType() { return -1; }
@Override public boolean isOpaqueCube() { return false; }
@Override public boolean renderAsNormalBlock() { return false; }
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
@ -75,14 +64,11 @@ public class MachineAutosaw extends BlockContainer implements ILookOverlay, IToo
@Override
public boolean onScrew(World world, EntityPlayer player, int x, int y, int z, int side, float fX, float fY, float fZ, ToolType tool) {
if(tool != ToolType.SCREWDRIVER)
return false;
if(tool != ToolType.SCREWDRIVER) return false;
TileEntity te = world.getTileEntity(x, y, z);
if(!(te instanceof TileEntityMachineAutosaw))
return false;
if(!(te instanceof TileEntityMachineAutosaw)) return false;
TileEntityMachineAutosaw saw = (TileEntityMachineAutosaw) te;
saw.isSuspended = !saw.isSuspended;
@ -95,16 +81,14 @@ public class MachineAutosaw extends BlockContainer implements ILookOverlay, IToo
public void printHook(Pre event, World world, int x, int y, int z) {
TileEntity te = world.getTileEntity(x, y, z);
if(!(te instanceof TileEntityMachineAutosaw))
return;
if(!(te instanceof TileEntityMachineAutosaw)) return;
TileEntityMachineAutosaw saw = (TileEntityMachineAutosaw) te;
List<String> text = new ArrayList();
text.add(saw.tank.getTankType().getLocalizedName() + ": " + saw.tank.getFill() + "/" + saw.tank.getMaxFill() + "mB");
if (saw.isSuspended) {
if(saw.isSuspended) {
text.add(EnumChatFormatting.RED + "! " + I18nUtil.resolveKey(getUnlocalizedName() + ".suspended") + " !");
}

View File

@ -0,0 +1,103 @@
package com.hbm.blocks.machine;
import java.util.ArrayList;
import java.util.List;
import com.hbm.blocks.ILookOverlay;
import com.hbm.blocks.ITooltipProvider;
import com.hbm.inventory.fluid.FluidType;
import com.hbm.items.machine.IItemFluidIdentifier;
import com.hbm.tileentity.machine.TileEntityMachineAutosaw;
import com.hbm.tileentity.machine.TileEntityMachineThresher;
import com.hbm.util.i18n.I18nUtil;
import api.hbm.block.IToolable;
import net.minecraft.block.BlockContainer;
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.ChatComponentText;
import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.util.ChatStyle;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.World;
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
public class MachineThresher extends BlockContainer implements ILookOverlay, ITooltipProvider, IToolable {
public MachineThresher() {
super(Material.iron);
}
@Override
public TileEntity createNewTileEntity(World world, int meta) {
return new TileEntityMachineThresher();
}
@Override public int getRenderType() { return -1; }
@Override public boolean isOpaqueCube() { return false; }
@Override public boolean renderAsNormalBlock() { return false; }
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
if(!world.isRemote && !player.isSneaking()) {
if(player.getHeldItem() != null && player.getHeldItem().getItem() instanceof IItemFluidIdentifier) {
TileEntityMachineThresher saw = (TileEntityMachineThresher) world.getTileEntity(x, y, z);
FluidType type = ((IItemFluidIdentifier) player.getHeldItem().getItem()).getType(world, x, y, z, player.getHeldItem());
if(TileEntityMachineAutosaw.acceptedFuels.contains(type)) {
saw.tank.setTankType(type);
saw.markDirty();
player.addChatComponentMessage(new ChatComponentText("Changed type to ").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.YELLOW)).appendSibling(new ChatComponentTranslation(type.getConditionalName())).appendSibling(new ChatComponentText("!")));
return true;
}
}
return false;
}
return true;
}
@Override
public boolean onScrew(World world, EntityPlayer player, int x, int y, int z, int side, float fX, float fY, float fZ, ToolType tool) {
if(tool != ToolType.SCREWDRIVER) return false;
TileEntity te = world.getTileEntity(x, y, z);
if(!(te instanceof TileEntityMachineThresher)) return false;
TileEntityMachineThresher saw = (TileEntityMachineThresher) te;
saw.isSuspended = !saw.isSuspended;
saw.markDirty();
return true;
}
@Override
public void printHook(Pre event, World world, int x, int y, int z) {
TileEntity te = world.getTileEntity(x, y, z);
if(!(te instanceof TileEntityMachineThresher)) return;
TileEntityMachineThresher saw = (TileEntityMachineThresher) te;
List<String> text = new ArrayList();
text.add(saw.tank.getTankType().getLocalizedName() + ": " + saw.tank.getFill() + "/" + saw.tank.getMaxFill() + "mB");
if(saw.isSuspended) {
text.add(EnumChatFormatting.RED + "! " + I18nUtil.resolveKey(getUnlocalizedName() + ".suspended") + " !");
}
ILookOverlay.printGeneric(event, I18nUtil.resolveKey(getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text);
}
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean ext) {
this.addStandardInfo(stack, player, list, ext);
}
}

View File

@ -348,6 +348,7 @@ public class ClientProxy extends ServerProxy {
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineMixer.class, new RenderMixer());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineHephaestus.class, new RenderHephaestus());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineAutosaw.class, new RenderAutosaw());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineThresher.class, new RenderThresher());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineVacuumDistill.class, new RenderVacuumDistill());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineCatalyticReformer.class, new RenderCatalyticReformer());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineHydrotreater.class, new RenderHydrotreater());

View File

@ -175,6 +175,7 @@ public class ResourceManager {
//Big Man Johnson
public static final IModelCustom autosaw = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/autosaw.obj")).noSmooth().asVBO();
public static final IModelCustom thresher = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/thresher.obj")).asVBO();
//Mining Drill
public static final IModelCustom mining_drill = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/mining_drill.obj")).asVBO();
@ -628,6 +629,7 @@ public class ResourceManager {
//Big Man Johnson
public static final ResourceLocation autosaw_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/autosaw.png");
public static final ResourceLocation thresher_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/thresher.png");
//Mining Drill
public static final ResourceLocation mining_drill_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/mining_drill.png");

View File

@ -0,0 +1,96 @@
package com.hbm.render.tileentity;
import org.lwjgl.opengl.GL11;
import com.hbm.blocks.ModBlocks;
import com.hbm.main.ResourceManager;
import com.hbm.render.item.ItemRenderBase;
import com.hbm.tileentity.machine.TileEntityMachineThresher;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.client.IItemRenderer;
public class RenderThresher extends TileEntitySpecialRenderer implements IItemRendererProvider {
@Override
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float interp) {
GL11.glPushMatrix();
GL11.glTranslated(x + 0.5D, y, z + 0.5D);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_CULL_FACE);
switch(tile.getBlockMetadata()) {
case 3: GL11.glRotatef(270, 0F, 1F, 0F); break;
case 5: GL11.glRotatef(0, 0F, 1F, 0F); break;
case 2: GL11.glRotatef(90, 0F, 1F, 0F); break;
case 4: GL11.glRotatef(180, 0F, 1F, 0F); break;
}
TileEntityMachineThresher thresher = (TileEntityMachineThresher) tile;
double angle = thresher.prevAngle + (thresher.angle - thresher.prevAngle) * interp;
double spin = thresher.lastSpin + (thresher.spin - thresher.spin) * interp;
double engine = thresher.isOn ? Math.sin(thresher.getWorldObj().getTotalWorldTime() * 2 % (Math.PI * 2) + interp) : 0;
renderCommon(82.5, spin, engine);
GL11.glPopMatrix();
}
private void renderCommon(double angle, double spin, double engine) {
GL11.glShadeModel(GL11.GL_SMOOTH);
bindTexture(ResourceManager.thresher_tex);
ResourceManager.thresher.renderPart("Base");
GL11.glPushMatrix(); {
GL11.glTranslated(0, engine * 0.01, 0);
ResourceManager.thresher.renderPart("Engine");
} GL11.glPopMatrix();
GL11.glTranslated(0, 0.5, -1);
GL11.glRotated(angle, 1, 0, 0);
GL11.glTranslated(0, -0.5, 1);
ResourceManager.thresher.renderPart("ArmUpper");
GL11.glTranslated(0, 0.5, -5);
GL11.glRotated(angle * -2, 1, 0, 0);
GL11.glTranslated(0, -0.5, 5);
GL11.glTranslated(-0.01, 0, 0);
ResourceManager.thresher.renderPart("ArmLower");
GL11.glTranslated(0.01, 0, 0);
GL11.glTranslated(0, 0.5, -9);
GL11.glRotated(angle, 1, 0, 0);
GL11.glTranslated(0, -0.5, 9);
ResourceManager.thresher.renderPart("Front");
GL11.glTranslated(0, 0.5, -11);
GL11.glRotated(-spin, 1, 0, 0);
GL11.glTranslated(0, -0.5, 11);
ResourceManager.thresher.renderPart("Wheel");
GL11.glShadeModel(GL11.GL_FLAT);
}
@Override
public Item getItemForRenderer() {
return Item.getItemFromBlock(ModBlocks.machine_thresher);
}
@Override
public IItemRenderer getRenderer() {
return new ItemRenderBase( ) {
public void renderInventory() {
GL11.glTranslated(0, 4, -8);
GL11.glScaled(4.5, 4.5, 4.5);
}
public void renderCommon() {
GL11.glScaled(0.5, 0.5, 0.5);
GL11.glRotated(90, 0, -1, 0);
RenderThresher.this.renderCommon(80D, System.currentTimeMillis() % 3600 * 0.25D, 0);
}};
}
}

View File

@ -326,6 +326,7 @@ public class TileMappings {
put(TileEntityDiFurnaceRTG.class, "tileentity_rtg_difurnace");
put(TileEntityMachineRadiolysis.class, "tileentity_radiolysis");
put(TileEntityMachineAutosaw.class, "tileentity_autosaw");
put(TileEntityMachineThresher.class, "tileentity_thresher");
put(TileEntityCondenser.class, "tileentity_condenser");
put(TileEntityTowerSmall.class, "tileentity_cooling_tower_small");

View File

@ -20,7 +20,7 @@ import com.hbm.packet.toclient.AuxParticlePacketNT;
import com.hbm.tileentity.IBufPacketReceiver;
import com.hbm.tileentity.TileEntityLoadedBase;
import api.hbm.fluid.IFluidStandardReceiver;
import api.hbm.fluidmk2.IFluidStandardReceiverMK2;
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@ -41,7 +41,7 @@ import net.minecraft.world.World;
import net.minecraftforge.common.IPlantable;
import net.minecraftforge.common.util.ForgeDirection;
public class TileEntityMachineAutosaw extends TileEntityLoadedBase implements IBufPacketReceiver, IFluidStandardReceiver, IFluidCopiable {
public class TileEntityMachineAutosaw extends TileEntityLoadedBase implements IBufPacketReceiver, IFluidStandardReceiverMK2, IFluidCopiable {
private static final int MIN_DIST = 2;
private static final int MAX_DIST = 9;
@ -106,7 +106,9 @@ public class TileEntityMachineAutosaw extends TileEntityLoadedBase implements IB
this.isOn = false;
}
this.subscribeToAllAround(tank.getTankType(), this);
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
if(dir != ForgeDirection.UP) trySubscribe(tank.getTankType(), worldObj, xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ, dir);
}
}
if(isOn && !isSuspended) {

View File

@ -0,0 +1,211 @@
package com.hbm.tileentity.machine;
import java.util.ArrayList;
import com.hbm.inventory.fluid.Fluids;
import com.hbm.inventory.fluid.tank.FluidTank;
import com.hbm.tileentity.IBufPacketReceiver;
import com.hbm.tileentity.IFluidCopiable;
import com.hbm.tileentity.TileEntityLoadedBase;
import api.hbm.fluidmk2.IFluidStandardReceiverMK2;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import io.netty.buffer.ByteBuf;
import net.minecraft.block.Block;
import net.minecraft.block.IGrowable;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.MathHelper;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import net.minecraftforge.common.IPlantable;
import net.minecraftforge.common.util.ForgeDirection;
public class TileEntityMachineThresher extends TileEntityLoadedBase implements IBufPacketReceiver, IFluidStandardReceiverMK2, IFluidCopiable {
public FluidTank tank;
public boolean isOn;
public boolean isSuspended;
private int turnProgress;
public float syncAngle;
public float angle;
public float prevAngle;
// 0: waiting, 1: extending, 2: retracting
private int state = 0;
public float spin;
public float lastSpin;
public TileEntityMachineThresher() {
this.tank = new FluidTank(Fluids.WOODOIL, 100);
}
@Override
public void updateEntity() {
if(!worldObj.isRemote) {
networkPackNT(100);
} else {
this.lastSpin = this.spin;
if(isOn && !isSuspended) {
this.spin += 15F;
Vec3 vec = Vec3.createVectorHelper(0.625, 0, 1.625);
vec.rotateAroundY(-(float) Math.toRadians(angle));
worldObj.spawnParticle("smoke", xCoord + 0.5 + vec.xCoord, yCoord + 2.0625, zCoord + 0.5 + vec.zCoord, 0, 0, 0);
}
if(this.spin >= 360F) {
this.spin -= 360F;
this.lastSpin -= 360F;
}
this.prevAngle = this.angle;
if(this.turnProgress > 0) {
double d0 = MathHelper.wrapAngleTo180_double(this.syncAngle - (double) this.angle);
this.angle = (float) ((double) this.angle + d0 / (double) this.turnProgress);
--this.turnProgress;
} else {
this.angle = this.syncAngle;
}
}
}
public static boolean shouldIgnore(World world, int x, int y, int z, Block b, int meta) {
if((b instanceof IGrowable)) {
return ((IGrowable) b).func_149851_a(world, x, y, z, world.isRemote);
}
return false;
}
protected void cutCrop(int x, int y, int z) {
Block soil = worldObj.getBlock(x, y - 1, z);
Block b = worldObj.getBlock(x, y, z);
int meta = worldObj.getBlockMetadata(x, y, z);
worldObj.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(b) + (meta << 12));
Block replacementBlock = Blocks.air;
int replacementMeta = 0;
if (!worldObj.isRemote && !worldObj.restoringBlockSnapshots) {
ArrayList<ItemStack> drops = b.getDrops(worldObj, x, y, z, meta, 0);
boolean replanted = false;
for (ItemStack drop : drops) {
if (!replanted && drop.getItem() instanceof IPlantable) {
IPlantable seed = (IPlantable) drop.getItem();
if(soil.canSustainPlant(worldObj, x, y - 1, z, ForgeDirection.UP, seed)) {
replacementBlock = seed.getPlant(worldObj, x, y, z);
replacementMeta = seed.getPlantMetadata(worldObj, x, y, z);
replanted = true;
drop.stackSize -= 1;
}
}
float delta = 0.7F;
double dx = (double)(worldObj.rand.nextFloat() * delta) + (double)(1.0F - delta) * 0.5D;
double dy = (double)(worldObj.rand.nextFloat() * delta) + (double)(1.0F - delta) * 0.5D;
double dz = (double)(worldObj.rand.nextFloat() * delta) + (double)(1.0F - delta) * 0.5D;
EntityItem entityItem = new EntityItem(worldObj, x + dx, y + dy, z + dz, drop);
entityItem.delayBeforeCanPickup = 10;
worldObj.spawnEntityInWorld(entityItem);
}
// Apparently, until 1.14 full-grown wheat could sometimes drop no seeds at all
// This is a quick and dirty workaround for that.
if (b == Blocks.wheat && !replanted) {
replacementBlock = b;
replacementMeta = 0;
replanted = true;
}
}
worldObj.setBlock(x, y, z, replacementBlock, replacementMeta, 3);
}
@Override
public void serialize(ByteBuf buf) {
buf.writeBoolean(this.isOn);
buf.writeBoolean(this.isSuspended);
buf.writeFloat(this.angle);
this.tank.serialize(buf);
}
@Override
public void deserialize(ByteBuf buf) {
this.isOn = buf.readBoolean();
this.isSuspended = buf.readBoolean();
this.syncAngle = buf.readFloat();
this.turnProgress = 3; //use 3-ply for extra smoothness
this.tank.deserialize(buf);
}
@Override
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
this.isOn = nbt.getBoolean("isOn");
this.isSuspended = nbt.getBoolean("isSuspended");
this.angle = nbt.getFloat("angle");
this.state = nbt.getInteger("state");
this.tank.readFromNBT(nbt, "t");
}
@Override
public void writeToNBT(NBTTagCompound nbt) {
super.writeToNBT(nbt);
nbt.setBoolean("isOn", this.isOn);
nbt.setBoolean("isSuspended", this.isSuspended);
nbt.setFloat("angle", this.angle);
nbt.setInteger("state", this.state);
tank.writeToNBT(nbt, "t");
}
@Override public FluidTank[] getAllTanks() { return new FluidTank[] {tank}; }
@Override public FluidTank[] getReceivingTanks() { return new FluidTank[] {tank}; }
AxisAlignedBB bb = null;
@Override
public AxisAlignedBB getRenderBoundingBox() {
if(bb == null) {
bb = AxisAlignedBB.getBoundingBox(
xCoord - 10,
yCoord,
zCoord - 10,
xCoord + 11,
yCoord + 7,
zCoord + 11
);
}
return bb;
}
@Override
@SideOnly(Side.CLIENT)
public double getMaxRenderDistanceSquared() {
return 65536.0D;
}
@Override public FluidTank getTankToPaste() { return tank; }
}

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB