destroy tickets when we aren't using them

This commit is contained in:
Boblet 2025-05-28 16:56:21 +02:00
parent acbea88eca
commit 9ff55acccf
20 changed files with 107 additions and 32 deletions

View File

@ -26,4 +26,6 @@
* Fixed non-standard template folder recipes not using the correct icon
* Fixed jetpack flight time not resetting when equipped like armor, causing kicks on servers that don't have flying cheats allowed
* Fixed missing energy damage category localization
* Fixed server crash caused by tool abilities
* Fixed server crash caused by tool abilities
* Fixed chunkloading entities not releasing their loading tickets properly
* Potentially fixed a dupe issue related to tool abilities

View File

@ -1,6 +1,7 @@
package com.hbm.blocks.machine;
import com.hbm.blocks.BlockDummyable;
import com.hbm.tileentity.machine.TileEntityMachineChemicalPlant;
import net.minecraft.block.material.Material;
import net.minecraft.tileentity.TileEntity;
@ -14,6 +15,7 @@ public class MachineChemicalPlant extends BlockDummyable {
@Override
public TileEntity createNewTileEntity(World world, int meta) {
if(meta >= 12) return new TileEntityMachineChemicalPlant();
return null;
}

View File

@ -209,9 +209,7 @@ public class EntityDeliveryDrone extends EntityDroneBase implements IInventory,
public void clearChunkLoader() {
if(!worldObj.isRemote && loaderTicket != null) {
for(ChunkCoordIntPair chunk : loaderTicket.getChunkList()) {
ForgeChunkManager.unforceChunk(loaderTicket, chunk);
}
ForgeChunkManager.releaseTicket(loaderTicket);
}
}

View File

@ -45,7 +45,7 @@ public abstract class EntityExplosionChunkloading extends Entity implements IChu
public void clearChunkLoader() {
if(!worldObj.isRemote && loaderTicket != null && loadedChunk != null) {
ForgeChunkManager.unforceChunk(loaderTicket, loadedChunk);
ForgeChunkManager.releaseTicket(loaderTicket);
}
}
}

View File

@ -187,7 +187,7 @@ public abstract class EntityPlaneBase extends Entity implements IChunkLoader {
public void clearChunkLoader() {
if(!worldObj.isRemote && loaderTicket != null) {
for(ChunkCoordIntPair chunk : loadedChunks) ForgeChunkManager.unforceChunk(loaderTicket, chunk);
ForgeChunkManager.releaseTicket(loaderTicket);
}
}

View File

@ -74,7 +74,6 @@ public class EntityMissileAntiBallistic extends EntityThrowableInterp implements
if(prevTracking == null && this.tracking != null) {
ExplosionLarge.spawnShock(worldObj, posX, posY, posZ, 24, 3F);
}
if(this.tracking != null && !this.tracking.isDead) {
this.aimAtTarget();
} else {
@ -222,9 +221,7 @@ public class EntityMissileAntiBallistic extends EntityThrowableInterp implements
public void clearChunkLoader() {
if(!worldObj.isRemote && loaderTicket != null) {
for(ChunkCoordIntPair chunk : loadedChunks) {
ForgeChunkManager.unforceChunk(loaderTicket, chunk);
}
ForgeChunkManager.releaseTicket(loaderTicket);
}
}

View File

@ -348,9 +348,7 @@ public abstract class EntityMissileBaseNT extends EntityThrowableInterp implemen
public void clearChunkLoader() {
if(!worldObj.isRemote && loaderTicket != null) {
for(ChunkCoordIntPair chunk : loadedChunks) {
ForgeChunkManager.unforceChunk(loaderTicket, chunk);
}
ForgeChunkManager.releaseTicket(loaderTicket);
}
}

View File

@ -178,9 +178,7 @@ public class EntityArtilleryRocket extends EntityThrowableInterp implements IChu
public void clearChunkLoader() {
if(!worldObj.isRemote && loaderTicket != null) {
for(ChunkCoordIntPair chunk : loadedChunks) {
ForgeChunkManager.unforceChunk(loaderTicket, chunk);
}
ForgeChunkManager.releaseTicket(loaderTicket);
}
}

View File

@ -213,9 +213,7 @@ public class EntityArtilleryShell extends EntityThrowableNT implements IChunkLoa
public void clearChunkLoader() {
if(!worldObj.isRemote && loaderTicket != null) {
for(ChunkCoordIntPair chunk : loadedChunks) {
ForgeChunkManager.unforceChunk(loaderTicket, chunk);
}
ForgeChunkManager.releaseTicket(loaderTicket);
}
}

View File

@ -60,9 +60,7 @@ public class EntityBulletBaseMK4CL extends EntityBulletBaseMK4 implements IChunk
public void clearChunkLoader() {
if(!worldObj.isRemote && loaderTicket != null) {
for(ChunkCoordIntPair chunk : loadedChunks) {
ForgeChunkManager.unforceChunk(loaderTicket, chunk);
}
ForgeChunkManager.releaseTicket(loaderTicket);
}
}

View File

@ -31,7 +31,6 @@ import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.Minecraft;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.EntityLivingBase;
@ -47,7 +46,6 @@ import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemTool;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.network.play.client.C07PacketPlayerDigging;
import net.minecraft.network.play.server.S23PacketBlockChange;
import net.minecraft.stats.StatList;
import net.minecraft.util.EnumChatFormatting;
@ -370,14 +368,6 @@ public class ItemToolAbility extends ItemTool implements IDepthRockTool, IGUIPro
player.destroyCurrentEquippedItem();
}
}
// TODO: Missing from other method, may be unneeded
if(flag && flag1) {
block.harvestBlock(world, player, x, y, z, l);
}
// TODO: Added from other method, may be unneeded
Minecraft.getMinecraft().getNetHandler().addToSendQueue(new C07PacketPlayerDigging(2, x, y, z, Minecraft.getMinecraft().objectMouseOver.sideHit));
}
// Why was this commented out?

View File

@ -268,6 +268,7 @@ public class ClientProxy extends ServerProxy {
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineAssembler.class, new RenderAssembler());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineAssemfac.class, new RenderAssemfac());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineChemplant.class, new RenderChemplant());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineChemicalPlant.class, new RenderChemicalPlant());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineChemfac.class, new RenderChemfac());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineFluidTank.class, new RenderFluidTank());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineBAT9000.class, new RenderBAT9000());

View File

@ -148,6 +148,7 @@ public class ResourceManager {
public static final IModelCustom chemplant_piston = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/chemplant_new_piston.obj"));
public static final IModelCustom chemplant_fluid = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/chemplant_new_fluid.hmf"));
public static final IModelCustom chemplant_fluidcap = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/chemplant_new_fluidcap.hmf"));
public static final IModelCustom chemical_plant = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/chemical_plant.obj"));
public static final IModelCustom chemfac = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/chemfac.obj"));
//Mixer
@ -579,6 +580,7 @@ public class ResourceManager {
public static final ResourceLocation chemplant_spinner_tex = new ResourceLocation(RefStrings.MODID, "textures/models/chemplant_spinner_new.png");
public static final ResourceLocation chemplant_piston_tex = new ResourceLocation(RefStrings.MODID, "textures/models/chemplant_piston_new.png");
public static final ResourceLocation chemplant_fluid_tex = new ResourceLocation(RefStrings.MODID, "textures/models/lavabase_small.png");
public static final ResourceLocation chemical_plant_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/chemical_plant.png");
public static final ResourceLocation chemfac_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/chemfac.png");
//Mixer

View File

@ -0,0 +1,55 @@
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 net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.client.IItemRenderer;
public class RenderChemicalPlant extends TileEntitySpecialRenderer implements IItemRendererProvider {
@Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float f) {
GL11.glPushMatrix();
GL11.glTranslated(x + 0.5, y, z + 0.5);
GL11.glRotated(90, 0, 1, 0);
GL11.glShadeModel(GL11.GL_SMOOTH);
bindTexture(ResourceManager.chemical_plant_tex);
ResourceManager.chemical_plant.renderPart("Base");
ResourceManager.chemical_plant.renderPart("Slider");
GL11.glShadeModel(GL11.GL_FLAT);
GL11.glPopMatrix();
}
@Override
public Item getItemForRenderer() {
return Item.getItemFromBlock(ModBlocks.machine_chemical_plant);
}
@Override
public IItemRenderer getRenderer() {
return new ItemRenderBase() {
public void renderInventory() {
GL11.glTranslated(0, -2, 0);
GL11.glScaled(3.5, 3.5, 3.5);
}
public void renderCommonWithStack(ItemStack item) {
GL11.glRotated(90, 0, 1, 0);
GL11.glScaled(0.75, 0.75, 0.75);
GL11.glShadeModel(GL11.GL_SMOOTH);
bindTexture(ResourceManager.chemical_plant_tex);
ResourceManager.chemical_plant.renderAll();
GL11.glShadeModel(GL11.GL_FLAT);
}};
}
}

View File

@ -12,6 +12,7 @@ import com.hbm.tileentity.machine.TileEntityMachineChemplant;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
@Deprecated
public class RenderChemplant extends TileEntitySpecialRenderer {
public RenderChemplant() {

View File

@ -0,0 +1,34 @@
package com.hbm.tileentity.machine;
import com.hbm.inventory.fluid.Fluids;
import com.hbm.inventory.fluid.tank.FluidTank;
import com.hbm.tileentity.TileEntityMachineBase;
public class TileEntityMachineChemicalPlant extends TileEntityMachineBase {
public FluidTank[] inputTanks;
public FluidTank[] outputTanks;
public long power;
public long maxPower = 1_000_000;
public TileEntityMachineChemicalPlant() {
super(22);
this.inputTanks = new FluidTank[3];
this.outputTanks = new FluidTank[3];
for(int i = 0; i < 3; i++) {
this.inputTanks[i] = new FluidTank(Fluids.NONE, 24_000);
this.outputTanks[i] = new FluidTank(Fluids.NONE, 24_000);
}
}
@Override
public String getName() {
return "container.machineChemicalPlant";
}
@Override
public void updateEntity() {
}
}

View File

@ -43,6 +43,7 @@ import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
@Deprecated
public class TileEntityMachineChemplant extends TileEntityMachineBase implements IEnergyReceiverMK2, IFluidStandardTransceiver, IGUIProvider, IUpgradeInfoProvider {
public long power;