Changed some tiny things

This commit is contained in:
Ellpeck 2015-07-07 12:32:25 +02:00
parent 4cf3797058
commit afcbc81d35
5 changed files with 56 additions and 57 deletions

View file

@ -19,7 +19,6 @@ public class RenderPlayerEventAA{
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void RenderPlayerEvent(RenderPlayerEvent.Pre event){
if(!event.entityPlayer.isInvisible() && !event.entityPlayer.getHideCape()){
//Ellpeck
if(event.entityPlayer.getUniqueID().equals(UUID.fromString("3f9f4a94-95e3-40fe-8895-e8e3e84d1468"))){
ellpeckRender.render(event.entityPlayer, event.partialRenderTick, 0.3F, 1F);
@ -50,4 +49,3 @@ public class RenderPlayerEventAA{
}
}
}
}

View file

@ -21,6 +21,8 @@ public class RenderSpecial{
}
public void render(EntityPlayer player, float renderTick, float size, float offsetUp){
if(player.isInvisible() || player.getHideCape()) return;
int bobHeight = 70;
long theTime = Minecraft.getSystemTime();
long time = theTime/50;

View file

@ -53,15 +53,15 @@ public class TileEntityBreaker extends TileEntityInventoryBase{
int meta = worldObj.getBlockMetadata(coordsBlock.getX(), coordsBlock.getY(), coordsBlock.getZ());
drops.addAll(blockToBreak.getDrops(worldObj, coordsBlock.getX(), coordsBlock.getY(), coordsBlock.getZ(), meta, 0));
if(addToInventory(this.slots, drops, false)){
if(WorldUtil.addToInventory(this.slots, drops, false)){
worldObj.playAuxSFX(2001, coordsBlock.getX(), coordsBlock.getY(), coordsBlock.getZ(), Block.getIdFromBlock(blockToBreak) + (meta << 12));
WorldUtil.breakBlockAtSide(sideToManipulate, worldObj, xCoord, yCoord, zCoord);
addToInventory(this.slots, drops, true);
WorldUtil.addToInventory(this.slots, drops, true);
this.markDirty();
}
}
else if(this.isPlacer && worldObj.getBlock(coordsBlock.getX(), coordsBlock.getY(), coordsBlock.getZ()).isReplaceable(worldObj, coordsBlock.getX(), coordsBlock.getY(), coordsBlock.getZ())){
int theSlot = testInventory(this.slots);
int theSlot = WorldUtil.findFirstEmptySlot(this.slots);
this.setInventorySlotContents(theSlot, WorldUtil.placeBlockAtSide(sideToManipulate, worldObj, xCoord, yCoord, zCoord, this.slots[theSlot]));
if(this.slots[theSlot] != null && this.slots[theSlot].stackSize <= 0) this.slots[theSlot] = null;
}
@ -85,32 +85,6 @@ public class TileEntityBreaker extends TileEntityInventoryBase{
this.currentTime = compound.getInteger("CurrentTime");
}
public static boolean addToInventory(ItemStack[] slots, ArrayList<ItemStack> stacks, boolean actuallyDo){
int working = 0;
for(ItemStack stack : stacks){
for(int i = 0; i < slots.length; i++){
if(slots[i] == null || (slots[i].isItemEqual(stack) && slots[i].stackSize <= stack.getMaxStackSize()-stack.stackSize)){
working++;
if(actuallyDo){
if(slots[i] == null) slots[i] = stack.copy();
else slots[i].stackSize += stack.stackSize;
}
break;
}
}
}
return working >= stacks.size();
}
public static int testInventory(ItemStack[] slots){
for(int i = 0; i < slots.length; i++){
if(slots[i] != null){
return i;
}
}
return 0;
}
@Override
public boolean isItemValidForSlot(int i, ItemStack stack){
return this.isPlacer;

View file

@ -63,17 +63,17 @@ public class TileEntityPhantomPlacer extends TileEntityInventoryBase{
int meta = boundPosition.getWorld().getBlockMetadata(boundPosition.getX(), boundPosition.getY(), boundPosition.getZ());
drops.addAll(blockToBreak.getDrops(boundPosition.getWorld(), boundPosition.getX(), boundPosition.getY(), boundPosition.getZ(), meta, 0));
if(TileEntityBreaker.addToInventory(this.slots, drops, false)){
if(WorldUtil.addToInventory(this.slots, drops, false)){
boundPosition.getWorld().playAuxSFX(2001, boundPosition.getX(), boundPosition.getY(), boundPosition.getZ(), Block.getIdFromBlock(blockToBreak)+(meta << 12));
WorldUtil.breakBlockAtSide(ForgeDirection.UNKNOWN, boundPosition.getWorld(), boundPosition.getX(), boundPosition.getY(), boundPosition.getZ());
TileEntityBreaker.addToInventory(this.slots, drops, true);
WorldUtil.addToInventory(this.slots, drops, true);
this.markDirty();
}
}
}
else{
if(boundPosition.getWorld().getBlock(boundPosition.getX(), boundPosition.getY(), boundPosition.getZ()).isReplaceable(boundPosition.getWorld(), boundPosition.getX(), boundPosition.getY(), boundPosition.getZ())){
int theSlot = TileEntityBreaker.testInventory(this.slots);
int theSlot = WorldUtil.findFirstEmptySlot(this.slots);
this.setInventorySlotContents(theSlot, WorldUtil.placeBlockAtSide(ForgeDirection.UNKNOWN, boundPosition.getWorld(), boundPosition.getX(), boundPosition.getY(), boundPosition.getZ(), this.slots[theSlot]));
if(this.slots[theSlot] != null && this.slots[theSlot].stackSize <= 0) this.slots[theSlot] = null;
}

View file

@ -183,4 +183,29 @@ public class WorldUtil{
return blocks;
}
public static boolean addToInventory(ItemStack[] slots, ArrayList<ItemStack> stacks, boolean actuallyDo){
int working = 0;
for(ItemStack stack : stacks){
for(int i = 0; i < slots.length; i++){
if(slots[i] == null || (slots[i].isItemEqual(stack) && slots[i].stackSize <= stack.getMaxStackSize()-stack.stackSize)){
working++;
if(actuallyDo){
if(slots[i] == null) slots[i] = stack.copy();
else slots[i].stackSize += stack.stackSize;
}
break;
}
}
}
return working >= stacks.size();
}
public static int findFirstEmptySlot(ItemStack[] slots){
for(int i = 0; i < slots.length; i++){
if(slots[i] != null){
return i;
}
}
return 0;
}
}