large door, some more fixes

This commit is contained in:
Bob 2022-04-21 23:34:51 +02:00
parent bc98b85c19
commit 85165e0621
7 changed files with 38 additions and 22 deletions

View File

@ -15,7 +15,6 @@ import net.minecraft.block.material.Material;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;

View File

@ -13,7 +13,6 @@ import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
@ -74,6 +73,8 @@ public class BlockDoorGeneric extends BlockDummyable {
AxisAlignedBB box = getCollisionBoundingBoxFromPool(worldIn, x, y, z);
if(box.minY == 0 && box.maxY == 0)
return;
if(hasExtra(worldIn.getBlockMetadata(x, y, z)))
return;
super.addCollisionBoxesToList( worldIn, x, y, z, entityBox, collidingBoxes, entityIn);
}
@ -107,15 +108,11 @@ public class BlockDoorGeneric extends BlockDummyable {
ForgeDirection dir = ForgeDirection.getOrientation(te2.getBlockMetadata() - BlockDummyable.offset);
AxisAlignedBB box = type.getBlockBound(x - core[0], y - core[1], z - core[2], open ); //.rotate(dir.getBlockRotation().add(Rotation.COUNTERCLOCKWISE_90)), open); TODO: add rotation
//System.out.println(te2.getBlockMetadata()-offset);
switch(te2.getBlockMetadata()-offset){
case 2:
return AxisAlignedBB.getBoundingBox(1-box.minX, box.minY, 1-box.minZ, 1-box.maxX, box.maxY, 1-box.maxZ);
case 4:
return AxisAlignedBB.getBoundingBox(1-box.minZ, box.minY, box.minX, 1-box.maxZ, box.maxY, box.maxX);
case 3:
return AxisAlignedBB.getBoundingBox(box.minX, box.minY, box.minZ, box.maxX, box.maxY, box.maxZ);
case 5:
return AxisAlignedBB.getBoundingBox(box.minZ, box.minY, 1-box.minX, box.maxZ, box.maxY, 1-box.maxX);
switch(te2.getBlockMetadata() - offset){
case 2: return AxisAlignedBB.getBoundingBox(1 - box.minX, box.minY, 1 - box.minZ, 1 - box.maxX, box.maxY, 1 - box.maxZ);
case 4: return AxisAlignedBB.getBoundingBox(1 - box.minZ, box.minY, box.minX, 1 - box.maxZ, box.maxY, box.maxX);
case 3: return AxisAlignedBB.getBoundingBox(box.minX, box.minY, box.minZ, box.maxX, box.maxY, box.maxZ);
case 5: return AxisAlignedBB.getBoundingBox(box.minZ, box.minY, 1 - box.minX, box.maxZ, box.maxY, 1 - box.maxX);
}
return AxisAlignedBB.getBoundingBox(0, 0, 0, 1, 1, 1);
}

View File

@ -1269,6 +1269,21 @@ public class ItemRenderLibrary {
bindTexture(ResourceManager.substation_tex); ResourceManager.substation.renderAll();
GL11.glShadeModel(GL11.GL_FLAT);
}});
renderers.put(Item.getItemFromBlock(ModBlocks.charger), new ItemRenderBase( ) {
public void renderInventory() {
GL11.glTranslated(0, -7, 0);
GL11.glScaled(10, 10, 10);
}
public void renderCommon() {
GL11.glScaled(2, 2, 2);
GL11.glTranslated(0.5, 0, 0);
GL11.glShadeModel(GL11.GL_SMOOTH);
bindTexture(ResourceManager.charger_tex);
ResourceManager.charger.renderPart("Base");
ResourceManager.charger.renderPart("Slide");
GL11.glShadeModel(GL11.GL_FLAT);
}});
}
private static void bindTexture(ResourceLocation res) {

View File

@ -91,7 +91,7 @@ public class TileEntityDoorGeneric extends TileEntityLockableBase implements IAn
if(finalPos.equals(pos)) {
this.shouldUseBB = false;
} else {
((BlockDummyable)getBlockType()).removeExtra(worldObj, finalPos.getX(), finalPos.getY(), finalPos.getZ());
((BlockDummyable)getBlockType()).makeExtra(worldObj, finalPos.getX(), finalPos.getY(), finalPos.getZ());
}
}
}

View File

@ -19,8 +19,8 @@ public class TileEntityCharger extends TileEntityLoadedBase implements IEnergyUs
private List<EntityPlayer> players = new ArrayList();
private long charge = 0;
private int lastOp = 0;
long lastOp = 0;
boolean particles = false;
public int usingTicks;
@ -52,10 +52,12 @@ public class TileEntityCharger extends TileEntityLoadedBase implements IEnergyUs
}
}
particles = worldObj.getTotalWorldTime() - lastOp < 4;
particles = lastOp > 0;
if(particles) {
lastOp--;
if(worldObj.getTotalWorldTime() % 20 == 0)
worldObj.playSoundEffect(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, "random.fizz", 0.2F, 0.5F);
}
@ -116,8 +118,6 @@ public class TileEntityCharger extends TileEntityLoadedBase implements IEnergyUs
if(this.usingTicks < delay || power == 0)
return power;
lastOp = worldObj.getTotalWorldTime();
for(EntityPlayer player : players) {
for(int i = 0; i < 5; i++) {
@ -131,6 +131,8 @@ public class TileEntityCharger extends TileEntityLoadedBase implements IEnergyUs
toCharge = Math.min(toCharge, power / 5);
battery.chargeBattery(stack, toCharge);
power -= toCharge;
lastOp = 4;
}
}
}

View File

@ -227,10 +227,10 @@ public class TileEntityMachineChemplant extends TileEntityMachineBase implements
}
private void setupTanks(ChemRecipe recipe) {
if(recipe.inputFluids[0] != null) tanks[0].setTankType(recipe.inputFluids[0].type);
if(recipe.inputFluids[1] != null) tanks[1].setTankType(recipe.inputFluids[1].type);
if(recipe.outputFluids[0] != null) tanks[2].setTankType(recipe.outputFluids[0].type);
if(recipe.outputFluids[1] != null) tanks[3].setTankType(recipe.outputFluids[1].type);
if(recipe.inputFluids[0] != null) tanks[0].setTankType(recipe.inputFluids[0].type); else tanks[0].setTankType(Fluids.NONE);
if(recipe.inputFluids[1] != null) tanks[1].setTankType(recipe.inputFluids[1].type); else tanks[1].setTankType(Fluids.NONE);
if(recipe.outputFluids[0] != null) tanks[2].setTankType(recipe.outputFluids[0].type); else tanks[2].setTankType(Fluids.NONE);
if(recipe.outputFluids[1] != null) tanks[3].setTankType(recipe.outputFluids[1].type); else tanks[3].setTankType(Fluids.NONE);
}
private boolean hasRequiredFluids(ChemRecipe recipe) {

View File

@ -218,14 +218,17 @@ public class TileEntityMachinePress extends TileEntity implements ISidedInventor
}
}
if(burnTime > 0 || preheated) {
if(preheated)
power += 2;
if(burnTime > 0) {
this.burnTime--;
this.power++;
if(power > maxPower) {
power = maxPower;
}
} else {
if(power > 0 && !preheated) {
if(power > 0) {
power--;
}
}