diff --git a/client/src/main/java/client/Client.java b/client/src/main/java/client/Client.java index 460f2910..c30174c9 100755 --- a/client/src/main/java/client/Client.java +++ b/client/src/main/java/client/Client.java @@ -241,6 +241,12 @@ public class Client implements IThreadListener { } } + public static class ItemRedrawFunction implements BoolFunction { + public void apply(BoolVar cv, boolean value) { + Client.CLIENT.rescale(); + } + } + public static class LevelFunction implements EnumFunction { public void apply(EnumVar cv, LogLevel value) { Log.setLevel(value); @@ -440,9 +446,11 @@ public class Client implements IThreadListener { private int savedX = 0x80000000; @Variable(name = "win_pos_y", category = CVarCategory.WINDOW, min = -65536, max = 65536, display = "Fenster Y-Position") private int savedY = 0x80000000; - + @Variable(name = "gui_scale", category = CVarCategory.GUI, min = 1, max = 5, display = "Skalierung", unit = "x", callback = RedrawFunction.class) private int scaleVar = 2; + @Variable(name = "gui_scale_items", category = CVarCategory.GUI, display = "Gegenstände vergrößern", callback = ItemRedrawFunction.class) + public boolean scaleItems = true; @Variable(name = "phy_sensitivity", category = CVarCategory.INPUT, min = 0.01f, max = 10.0f, display = "Mausempfindlichkeit", precision = 2, unit = "%") private float sensitivity = 1.0f; @Variable(name = "gui_dclick_delay", category = CVarCategory.INPUT, min = 150, max = 750, display = "Doppelklick bei", unit = "ms") @@ -1101,7 +1109,7 @@ public class Client implements IThreadListener { ItemStack itemstack = this.player.inventory.mainInventory[index]; if(itemstack != null) { GuiContainer.renderItemOverlay(itemstack, - this.fbX / 2 - 180 + 4 + 1 + index * 40, this.fbY - 40 + 1, null, index == this.player.inventory.currentItem ? this.controller.getUseCooldown() : 0, this.controller.getUseCooldownMax()); + this.fbX / 2 - 180 + 4 + 1 + index * 40, this.fbY - 40 + 1, null, index == this.player.inventory.currentItem ? this.controller.getUseCooldown() : 0, this.controller.getUseCooldownMax(), 2); } } } diff --git a/client/src/main/java/client/gui/container/GuiContainer.java b/client/src/main/java/client/gui/container/GuiContainer.java index bbd2581d..2b3e6120 100755 --- a/client/src/main/java/client/gui/container/GuiContainer.java +++ b/client/src/main/java/client/gui/container/GuiContainer.java @@ -10,6 +10,7 @@ import java.util.Map.Entry; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL13; +import client.Client; import client.gui.Font; import client.gui.Gui; import client.gui.element.ActButton; @@ -84,6 +85,7 @@ public abstract class GuiContainer extends Gui protected int container_y; protected int container_w; protected int container_h; + protected int container_scale; private int hover_x; private int hover_y; @@ -192,41 +194,41 @@ public abstract class GuiContainer extends Gui } public Label label(String text, int x, int y) { - x = x * 2 + this.container_x; - y = y * 2 + this.container_y; + x = x * this.container_scale + this.container_x; + y = y * this.container_scale + this.container_y; return this.add(new Label(x, y, 300, 0, text, true)); } public void rect(int x, int y, int width, int height, int color) { - Drawing.drawRect(this.container_x + x * 2, this.container_y + y * 2, width * 2, height * 2, 0xff000000 | color); + Drawing.drawRect(this.container_x + x * this.container_scale, this.container_y + y * this.container_scale, width * this.container_scale, height * this.container_scale, 0xff000000 | color); } public void grad(int x, int y, int width, int height, int top, int bottom, int topleft, int btmright) { - Drawing.drawGradient(this.container_x + x * 2, this.container_y + y * 2, width * 2, height * 2, 0xff000000 | top, 0xff000000 | bottom, 0xff000000 | topleft, 0xff000000 | btmright); + Drawing.drawGradient(this.container_x + x * this.container_scale, this.container_y + y * this.container_scale, width * this.container_scale, height * this.container_scale, 0xff000000 | top, 0xff000000 | bottom, 0xff000000 | topleft, 0xff000000 | btmright); } public InventoryButton slot(int x, int y, int w, int h) { - return this.add(new InventoryButton(this.container_x + x * 2, this.container_y + y * 2, w * 2, h * 2)); + return this.add(new InventoryButton(this.container_x + x * this.container_scale, this.container_y + y * this.container_scale, w * this.container_scale, h * this.container_scale)); } public ActButton button(int x, int y, int w, int h, ButtonCallback callback, String text) { - return this.add(new ActButton(this.container_x + x * 2, this.container_y + y * 2, w * 2, h * 2, callback, text)); + return this.add(new ActButton(this.container_x + x * this.container_scale, this.container_y + y * this.container_scale, w * this.container_scale, h * this.container_scale, callback, text)); } public void mouse(Button btn, int x, int y, boolean ctrl, boolean shift) { super.mouse(btn, x, y, ctrl, shift); - this.mouseClicked((x - this.container_x) / 2, (y - this.container_y) / 2, btn.ordinal()); //TODO: enum + this.mouseClicked((x - this.container_x) / this.container_scale, (y - this.container_y) / this.container_scale, btn.ordinal()); //TODO: enum } public void mouserel(Button btn, int x, int y) { super.mouserel(btn, x, y); - this.mouseReleased((x - this.container_x) / 2, (y - this.container_y) / 2, btn.ordinal()); //TODO: enum + this.mouseReleased((x - this.container_x) / this.container_scale, (y - this.container_y) / this.container_scale, btn.ordinal()); //TODO: enum } public void drag(int x, int y) { super.drag(x, y); if(Button.MOUSE_LEFT.isDown() || Button.MOUSE_RIGHT.isDown() || Button.MOUSE_MIDDLE.isDown()) - this.mouseDragged((x - this.container_x) / 2, (y - this.container_y) / 2); + this.mouseDragged((x - this.container_x) / this.container_scale, (y - this.container_y) / this.container_scale); } public GuiContainer(Container container) @@ -239,8 +241,9 @@ public abstract class GuiContainer extends Gui this.itemRender = this.gm.getRenderItem(); this.tooltip = null; this.cheatStack = null; - this.container_x = (width - (this.container_w = (this.xSize * 2))) / 2; - this.container_y = (height - (this.container_h = (this.ySize * 2))) / 2; + this.container_scale = this.gm.scaleItems && this.xSize * 2 <= Client.MIN_WIDTH && this.ySize * 2 <= Client.MIN_HEIGHT ? 2 : 1; + this.container_x = (width - (this.container_w = (this.xSize * this.container_scale))) / 2; + this.container_y = (height - (this.container_h = (this.ySize * this.container_scale))) / 2; this.initGui(); this.addButtons(); this.addElements(); @@ -248,8 +251,8 @@ public abstract class GuiContainer extends Gui public void hover(String text, int x, int y) { this.tooltip = text; - this.hover_x = x * 2 + this.container_x + 16; - this.hover_y = y * 2 + this.container_y + 16; + this.hover_x = x * this.container_scale + this.container_x + 16; + this.hover_y = y * this.container_scale + this.container_y + 16; } public String getTitle() { @@ -302,8 +305,9 @@ public abstract class GuiContainer extends Gui if(this.gm.itemCheat) { GL11.glPushMatrix(); - GL11.glTranslatef(-(float)((this.gm.fbX - this.xSize * 2) / 2) * 0.5f, -(float)((this.gm.fbY - this.ySize * 2) / 2) * 0.5f, 0.0f); - GL11.glScalef(0.5f, 0.5f, 0.5f); + GL11.glTranslatef(-(float)((this.gm.fbX - this.xSize * this.container_scale) / 2) * (1.0f / (float)this.container_scale), -(float)((this.gm.fbY - this.ySize * this.container_scale) / 2) * (1.0f / (float)this.container_scale), 0.0f); + if(this.container_scale != 1) + GL11.glScalef(1.0f / (float)this.container_scale, 1.0f / (float)this.container_scale, 1.0f / (float)this.container_scale); int i = (ITEM_LIST.size() + this.cheatWidth - 1) / this.cheatWidth - this.cheatHeight; int j = (int)((double)(this.currentScroll * (float)i) + 0.5D); @@ -496,9 +500,10 @@ public abstract class GuiContainer extends Gui public void drawPost() { GL11.glPushMatrix(); - GL11.glTranslatef((float)((this.gm.fbX - this.xSize * 2) / 2), (float)((this.gm.fbY - this.ySize * 2) / 2), 0.0f); - GL11.glScalef(2.0f, 2.0f, 2.0f); - this.drawScreen((this.gm.mouseX - this.container_x) / 2, (this.gm.mouseY - this.container_y) / 2); + GL11.glTranslatef((float)((this.gm.fbX - this.xSize * this.container_scale) / 2), (float)((this.gm.fbY - this.ySize * this.container_scale) / 2), 0.0f); + if(this.container_scale != 1) + GL11.glScalef((float)this.container_scale, (float)this.container_scale, (float)this.container_scale); + this.drawScreen((this.gm.mouseX - this.container_x) / this.container_scale, (this.gm.mouseY - this.container_y) / this.container_scale); GL11.glPopMatrix(); ItemRenderer.disableStandardItemLighting(); } @@ -862,10 +867,10 @@ public abstract class GuiContainer extends Gui public void renderItemOverlayIntoGUI(ItemStack stack, int xPosition, int yPosition, String text) { - renderItemOverlay(stack, this.container_x + xPosition * 2, this.container_y + yPosition * 2, text, 0, 0); + renderItemOverlay(stack, this.container_x + xPosition * this.container_scale, this.container_y + yPosition * this.container_scale, text, 0, 0, this.container_scale); } - public static void renderItemOverlay(ItemStack stack, int xPosition, int yPosition, String text, int bar2, int bar2max) + public static void renderItemOverlay(ItemStack stack, int xPosition, int yPosition, String text, int bar2, int bar2max, int scale) { if (stack != null) { @@ -877,25 +882,25 @@ public abstract class GuiContainer extends Gui { s = TextColor.RED + formatAmount(stack.getSize()); } - Drawing.drawTextRight(s, xPosition + 32, yPosition + 33 - Font.YGLYPH, 0xffffffff); + Drawing.drawTextRight(s, xPosition + scale * 16, yPosition + scale * 16 + 1 - Font.YGLYPH, 0xffffffff); } if (stack.isItemDamaged()) { - int j = (int)Math.round(28.0D - (double)stack.getItemDamage() * 28.0D / (double)stack.getMaxDamage()); + int j = (int)Math.round(14.0D * (double)scale - (double)stack.getItemDamage() * (14.0D * (double)scale) / (double)stack.getMaxDamage()); int i = (int)Math.round(255.0D - (double)stack.getItemDamage() * 255.0D / (double)stack.getMaxDamage()); - draw(xPosition + 2, yPosition + 26, 28, 4, 0, 0, 0); - draw(xPosition + 2, yPosition + 26, 26, 2, (255 - i) / 4, 64, 0); - draw(xPosition + 2, yPosition + 26, j, 2, 255 - i, i, 0); + draw(xPosition + scale, yPosition + 13 * scale, 14 * scale, scale * 2, 0, 0, 0); + draw(xPosition + scale, yPosition + 13 * scale, 13 * scale, scale, (255 - i) / 4, 64, 0); + draw(xPosition + scale, yPosition + 13 * scale, j, scale, 255 - i, i, 0); } if (bar2 > 0) { - int j = (int)Math.round(28.0D - (double)bar2 * 28.0D / (double)bar2max); + int j = (int)Math.round(14.0D * (double)scale - (double)bar2 * (14.0D * (double)scale) / (double)bar2max); int i = (int)Math.round(255.0D - (double)bar2 * 255.0D / (double)bar2max); - draw(xPosition + 2, yPosition + 4, 28, 4, 0, 0, 0); - draw(xPosition + 2, yPosition + 4, 26, 2, (255 - i) / 8, (255 - i) / 16, i / 4); - draw(xPosition + 2 + 28 - j, yPosition + 4, j, 2, (255 - i) / 2, (255 - i) / 4, i); + draw(xPosition + scale, yPosition + scale * 2, 14 * scale, scale * 2, 0, 0, 0); + draw(xPosition + scale, yPosition + scale * 2, 13 * scale, scale, (255 - i) / 8, (255 - i) / 16, i / 4); + draw(xPosition + scale + 14 * scale - j, yPosition + scale * 2, j, scale, (255 - i) / 2, (255 - i) / 4, i); } } } diff --git a/client/src/main/java/client/gui/options/GuiStyle.java b/client/src/main/java/client/gui/options/GuiStyle.java index d38d6e2b..7a8808a7 100644 --- a/client/src/main/java/client/gui/options/GuiStyle.java +++ b/client/src/main/java/client/gui/options/GuiStyle.java @@ -76,6 +76,7 @@ public class GuiStyle extends GuiOptions { this.addSelector("gui_scale", 0, 3 * 34 + 20, 240, 0); this.addSelector("gui_font", 242, 3 * 34 + 20, 240, 0); + this.addSelector("gui_scale_items", 0, 3 * 34 + 40, 240, 0); super.init(width, height); } diff --git a/client/src/main/resources/textures/blocks/jukebox_side.png b/client/src/main/resources/textures/blocks/jukebox_side.png deleted file mode 100755 index a3c27c18..00000000 Binary files a/client/src/main/resources/textures/blocks/jukebox_side.png and /dev/null differ diff --git a/client/src/main/resources/textures/blocks/jukebox_top.png b/client/src/main/resources/textures/blocks/jukebox_top.png deleted file mode 100755 index 92ddb158..00000000 Binary files a/client/src/main/resources/textures/blocks/jukebox_top.png and /dev/null differ diff --git a/client/src/main/resources/textures/blocks/noteblock.png b/client/src/main/resources/textures/blocks/noteblock.png deleted file mode 100755 index a3c27c18..00000000 Binary files a/client/src/main/resources/textures/blocks/noteblock.png and /dev/null differ diff --git a/common/src/main/java/common/block/Block.java b/common/src/main/java/common/block/Block.java index badb531d..6ac7764a 100755 --- a/common/src/main/java/common/block/Block.java +++ b/common/src/main/java/common/block/Block.java @@ -861,21 +861,29 @@ public class Block { return this.colorMultiplier(worldIn, pos, 0); } - public int getWeakPower(IWorldAccess worldIn, BlockPos pos, State state, Facing side) { - return 0; - } - public boolean canProvidePower() { return false; } - public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, State state, Entity entityIn) { + public int getWeakPower(IWorldAccess worldIn, BlockPos pos, State state, Facing side) { + return 0; } public int getStrongPower(IWorldAccess worldIn, BlockPos pos, State state, Facing side) { return 0; } + public boolean hasSignalProcessing() { + return false; + } + + public int getSignal(World worldIn, BlockPos pos, int input) { + return 0; + } + + public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, State state, Entity entityIn) { + } + public void setBlockBoundsForItemRender() { } @@ -926,10 +934,6 @@ public class Block { return this.material.getMobility(); } - public float getAmbientOcclusionLightValue() { - return this.isBlockNormalCube() ? 0.2F : 1.0F; - } - public void onFallenUpon(World worldIn, BlockPos pos, Entity entityIn, float fallDistance) { entityIn.fall(fallDistance, 1.0F); } @@ -972,14 +976,6 @@ public class Block { return blockIn != null && other != null ? (blockIn == other ? true : blockIn.isAssociatedBlock(other)) : false; } - public boolean hasComparatorInputOverride() { - return false; - } - - public int getComparatorInputOverride(World worldIn, BlockPos pos) { - return 0; - } - public State getStateForEntityRender(State state) { return state; } diff --git a/common/src/main/java/common/block/artificial/BlockCake.java b/common/src/main/java/common/block/artificial/BlockCake.java index 5b242247..c2708bac 100755 --- a/common/src/main/java/common/block/artificial/BlockCake.java +++ b/common/src/main/java/common/block/artificial/BlockCake.java @@ -219,12 +219,12 @@ public class BlockCake extends Block return new Property[] {BITES}; } - public int getComparatorInputOverride(World worldIn, BlockPos pos) + public int getSignal(World worldIn, BlockPos pos, int input) { return (7 - ((Integer)worldIn.getState(pos).getValue(BITES)).intValue()) * 2; } - public boolean hasComparatorInputOverride() + public boolean hasSignalProcessing() { return true; } diff --git a/common/src/main/java/common/block/artificial/BlockPortalFrame.java b/common/src/main/java/common/block/artificial/BlockPortalFrame.java index c59580c0..e54c5fd8 100755 --- a/common/src/main/java/common/block/artificial/BlockPortalFrame.java +++ b/common/src/main/java/common/block/artificial/BlockPortalFrame.java @@ -97,12 +97,12 @@ public class BlockPortalFrame extends Block implements Rotatable return this.getState().withProperty(FACING, placer.getHorizontalFacing().getOpposite()).withProperty(ORB, Boolean.valueOf(false)); } - public boolean hasComparatorInputOverride() + public boolean hasSignalProcessing() { return true; } - public int getComparatorInputOverride(World worldIn, BlockPos pos) + public int getSignal(World worldIn, BlockPos pos, int input) { return ((Boolean)worldIn.getState(pos).getValue(ORB)).booleanValue() ? 15 : 0; } diff --git a/common/src/main/java/common/block/tech/BlockBrewingStand.java b/common/src/main/java/common/block/tech/BlockBrewingStand.java index 829baa51..6279f44c 100755 --- a/common/src/main/java/common/block/tech/BlockBrewingStand.java +++ b/common/src/main/java/common/block/tech/BlockBrewingStand.java @@ -468,12 +468,12 @@ public class BlockBrewingStand extends BlockContainer return Items.brewing_stand; } - public boolean hasComparatorInputOverride() + public boolean hasSignalProcessing() { return true; } - public int getComparatorInputOverride(World worldIn, BlockPos pos) + public int getSignal(World worldIn, BlockPos pos, int input) { return Container.calcRedstone(worldIn.getTileEntity(pos)); } diff --git a/common/src/main/java/common/block/tech/BlockCauldron.java b/common/src/main/java/common/block/tech/BlockCauldron.java index 0690f3e0..e412b33e 100755 --- a/common/src/main/java/common/block/tech/BlockCauldron.java +++ b/common/src/main/java/common/block/tech/BlockCauldron.java @@ -585,12 +585,12 @@ public class BlockCauldron extends Block return Items.cauldron; } - public boolean hasComparatorInputOverride() + public boolean hasSignalProcessing() { return true; } - public int getComparatorInputOverride(World worldIn, BlockPos pos) + public int getSignal(World worldIn, BlockPos pos, int input) { return ((Integer)worldIn.getState(pos).getValue(LEVEL)).intValue(); } diff --git a/common/src/main/java/common/block/tech/BlockChest.java b/common/src/main/java/common/block/tech/BlockChest.java index a59fa638..7e235086 100755 --- a/common/src/main/java/common/block/tech/BlockChest.java +++ b/common/src/main/java/common/block/tech/BlockChest.java @@ -239,12 +239,12 @@ public class BlockChest extends BlockContainer implements Rotatable return false; } - public boolean hasComparatorInputOverride() + public boolean hasSignalProcessing() { return true; } - public int getComparatorInputOverride(World worldIn, BlockPos pos) + public int getSignal(World worldIn, BlockPos pos, int input) { return Container.calcRedstoneFromInventory(this.getChest(worldIn, pos)); } diff --git a/common/src/main/java/common/block/tech/BlockDispenser.java b/common/src/main/java/common/block/tech/BlockDispenser.java index b69e8fb6..70fdc063 100755 --- a/common/src/main/java/common/block/tech/BlockDispenser.java +++ b/common/src/main/java/common/block/tech/BlockDispenser.java @@ -230,12 +230,12 @@ public class BlockDispenser extends BlockContainer implements Directional return Facing.getFront(meta & 7); } - public boolean hasComparatorInputOverride() + public boolean hasSignalProcessing() { return true; } - public int getComparatorInputOverride(World worldIn, BlockPos pos) + public int getSignal(World worldIn, BlockPos pos, int input) { return Container.calcRedstone(worldIn.getTileEntity(pos)); } diff --git a/common/src/main/java/common/block/tech/BlockFurnace.java b/common/src/main/java/common/block/tech/BlockFurnace.java index d19eb028..0ac3b057 100755 --- a/common/src/main/java/common/block/tech/BlockFurnace.java +++ b/common/src/main/java/common/block/tech/BlockFurnace.java @@ -197,12 +197,12 @@ public class BlockFurnace extends BlockContainer implements Rotatable super.onBlockRemoved(worldIn, pos, state); } - public boolean hasComparatorInputOverride() + public boolean hasSignalProcessing() { return true; } - public int getComparatorInputOverride(World worldIn, BlockPos pos) + public int getSignal(World worldIn, BlockPos pos, int input) { return Container.calcRedstone(worldIn.getTileEntity(pos)); } diff --git a/common/src/main/java/common/block/tech/BlockHopper.java b/common/src/main/java/common/block/tech/BlockHopper.java index e8023105..10085c06 100755 --- a/common/src/main/java/common/block/tech/BlockHopper.java +++ b/common/src/main/java/common/block/tech/BlockHopper.java @@ -237,12 +237,12 @@ public class BlockHopper extends BlockContainer implements DirectionalDown return (meta & 8) != 8; } - public boolean hasComparatorInputOverride() + public boolean hasSignalProcessing() { return true; } - public int getComparatorInputOverride(World worldIn, BlockPos pos) + public int getSignal(World worldIn, BlockPos pos, int input) { return Container.calcRedstone(worldIn.getTileEntity(pos)); } diff --git a/common/src/main/java/common/block/tech/BlockJukebox.java b/common/src/main/java/common/block/tech/BlockJukebox.java deleted file mode 100755 index cfe625df..00000000 --- a/common/src/main/java/common/block/tech/BlockJukebox.java +++ /dev/null @@ -1,30 +0,0 @@ -package common.block.tech; - -import common.block.Block; -import common.block.Material; -import common.entity.npc.EntityNPC; -import common.init.SoundEvent; -import common.item.CheatTab; -import common.model.Model; -import common.model.ModelProvider; -import common.util.BlockPos; -import common.util.Facing; -import common.world.State; -import common.world.World; - -public class BlockJukebox extends Block { - public BlockJukebox() { - super(Material.WOOD); - this.setTab(CheatTab.TECHNOLOGY); - } - - public boolean onBlockActivated(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) { - if(!worldIn.client) - worldIn.playSound(worldIn.rand.pick(SoundEvent.values()), pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, 1.0f); - return true; - } - - public Model getModel(ModelProvider provider, String name, State state) { - return provider.getModel("jukebox_side").add().dnswe().u("jukebox_top"); - } -} diff --git a/common/src/main/java/common/block/tech/BlockMachine.java b/common/src/main/java/common/block/tech/BlockMachine.java index ab76ab1d..20745180 100755 --- a/common/src/main/java/common/block/tech/BlockMachine.java +++ b/common/src/main/java/common/block/tech/BlockMachine.java @@ -63,11 +63,11 @@ public abstract class BlockMachine extends Block implements Rotatable, ITileEnti worldIn.removeTileEntity(pos); } - public boolean hasComparatorInputOverride() { + public boolean hasSignalProcessing() { return true; } - public int getComparatorInputOverride(World worldIn, BlockPos pos) { + public int getSignal(World worldIn, BlockPos pos, int input) { return Container.calcRedstone(worldIn.getTileEntity(pos)); } diff --git a/common/src/main/java/common/block/tech/BlockNote.java b/common/src/main/java/common/block/tech/BlockNote.java deleted file mode 100755 index f843a7ef..00000000 --- a/common/src/main/java/common/block/tech/BlockNote.java +++ /dev/null @@ -1,44 +0,0 @@ -package common.block.tech; - -import common.block.Block; -import common.block.Material; -import common.entity.npc.EntityNPC; -import common.init.Blocks; -import common.init.SoundEvent; -import common.item.CheatTab; -import common.util.BlockPos; -import common.util.Facing; -import common.world.State; -import common.world.World; - -public class BlockNote extends Block { - public BlockNote() { - super(Material.WOOD); - this.setTab(CheatTab.TECHNOLOGY); - } - - public void onNeighborBlockChange(World worldIn, BlockPos pos, State state, Block neighborBlock) { - if(worldIn.isBlockPowered(pos)) - worldIn.addBlockEvent(pos, Blocks.noteblock, 0, 0); - } - - public boolean onBlockActivated(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) { - if(!worldIn.client) - worldIn.addBlockEvent(pos, Blocks.noteblock, 0, 0); - return true; - } - - public void onBlockClicked(World worldIn, BlockPos pos, EntityNPC playerIn) { - if(!worldIn.client) - worldIn.addBlockEvent(pos, Blocks.noteblock, 0, 0); - } - - public boolean onBlockEventReceived(World worldIn, BlockPos pos, State state, int eventID, int eventParam) { - worldIn.playSound(SoundEvent.NOTE, (double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, 3.0F); - return true; - } - - public boolean isMagnetic() { - return true; - } -} diff --git a/common/src/main/java/common/block/tech/BlockRailDetector.java b/common/src/main/java/common/block/tech/BlockRailDetector.java index e1e032d5..1c08f12b 100755 --- a/common/src/main/java/common/block/tech/BlockRailDetector.java +++ b/common/src/main/java/common/block/tech/BlockRailDetector.java @@ -133,12 +133,12 @@ public class BlockRailDetector extends BlockRailBase return SHAPE; } - public boolean hasComparatorInputOverride() + public boolean hasSignalProcessing() { return true; } - public int getComparatorInputOverride(World worldIn, BlockPos pos) + public int getSignal(World worldIn, BlockPos pos, int input) { if (((Boolean)worldIn.getState(pos).getValue(POWERED)).booleanValue()) { diff --git a/common/src/main/java/common/block/tech/BlockRedstoneComparator.java b/common/src/main/java/common/block/tech/BlockRedstoneComparator.java index 7ab0f4b6..f80b9c85 100755 --- a/common/src/main/java/common/block/tech/BlockRedstoneComparator.java +++ b/common/src/main/java/common/block/tech/BlockRedstoneComparator.java @@ -123,28 +123,19 @@ public class BlockRedstoneComparator extends BlockRedstoneDiode implements ITile BlockPos blockpos = pos.offset(enumfacing); Block block = worldIn.getState(blockpos).getBlock(); - if (block.hasComparatorInputOverride()) + if (block.hasSignalProcessing()) { - i = block.getComparatorInputOverride(worldIn, blockpos); + i = block.getSignal(worldIn, blockpos, 0); } else if (i < 15 && block.isNormalCube()) { blockpos = blockpos.offset(enumfacing); block = worldIn.getState(blockpos).getBlock(); - if (block.hasComparatorInputOverride()) + if (block.hasSignalProcessing()) { - i = block.getComparatorInputOverride(worldIn, blockpos); + i = block.getSignal(worldIn, blockpos, 0); } -// else if (block == Blocks.air) -// { -// EntityFrame entityitemframe = this.findItemFrame(worldIn, enumfacing, blockpos); -// -// if (entityitemframe != null) -// { -// i = entityitemframe.getItemRotation(); -// } -// } } return i; diff --git a/common/src/main/java/common/block/tech/BlockTNT.java b/common/src/main/java/common/block/tech/BlockTNT.java index de5e8c8d..e6c27784 100755 --- a/common/src/main/java/common/block/tech/BlockTNT.java +++ b/common/src/main/java/common/block/tech/BlockTNT.java @@ -49,29 +49,6 @@ public class BlockTNT extends Block return this.power; } - public void onBlockAdded(AWorldServer worldIn, BlockPos pos, State state) - { - super.onBlockAdded(worldIn, pos, state); - - if (worldIn.isBlockPowered(pos)) - { - this.onBlockDestroyedByPlayer(worldIn, pos, state.withProperty(EXPLODE, Boolean.valueOf(true))); - worldIn.setBlockToAir(pos); - } - } - - /** - * Called when a neighboring block changes. - */ - public void onNeighborBlockChange(World worldIn, BlockPos pos, State state, Block neighborBlock) - { - if (worldIn.isBlockPowered(pos)) - { - this.onBlockDestroyedByPlayer(worldIn, pos, state.withProperty(EXPLODE, Boolean.valueOf(true))); - worldIn.setBlockToAir(pos); - } - } - /** * Called when this Block is destroyed by an Explosion */ diff --git a/common/src/main/java/common/entity/npc/EntityNPC.java b/common/src/main/java/common/entity/npc/EntityNPC.java index d65762c5..0580a779 100755 --- a/common/src/main/java/common/entity/npc/EntityNPC.java +++ b/common/src/main/java/common/entity/npc/EntityNPC.java @@ -4496,7 +4496,6 @@ public abstract class EntityNPC extends EntityLiving this.removeEffect(Effect.FIRE_RESISTANCE); this.removeEffect(Effect.FLYING); this.removeEffect(Effect.MANA_GENERATION); - this.removeEffect(Effect.ITEM_REGENERATION); } else { this.extinguish(); @@ -4508,7 +4507,6 @@ public abstract class EntityNPC extends EntityLiving this.addEffect(new StatusEffect(Effect.FIRE_RESISTANCE, Integer.MAX_VALUE, 0)); this.addEffect(new StatusEffect(Effect.FLYING, Integer.MAX_VALUE, 1)); this.addEffect(new StatusEffect(Effect.MANA_GENERATION, Integer.MAX_VALUE, 255)); - this.addEffect(new StatusEffect(Effect.ITEM_REGENERATION, Integer.MAX_VALUE, 255)); } } diff --git a/common/src/main/java/common/entity/projectile/EntityBullet.java b/common/src/main/java/common/entity/projectile/EntityBullet.java index 1924aa65..36b03e39 100755 --- a/common/src/main/java/common/entity/projectile/EntityBullet.java +++ b/common/src/main/java/common/entity/projectile/EntityBullet.java @@ -297,4 +297,8 @@ public class EntityBullet extends Entity implements IProjectile, IObjectData { public EntityType getType() { return EntityType.PROJECTILE; } + + public Entity getShooter() { + return this.shooter; + } } diff --git a/common/src/main/java/common/entity/projectile/EntityMissile.java b/common/src/main/java/common/entity/projectile/EntityMissile.java index 059f2e91..95423105 100755 --- a/common/src/main/java/common/entity/projectile/EntityMissile.java +++ b/common/src/main/java/common/entity/projectile/EntityMissile.java @@ -46,7 +46,7 @@ public class EntityMissile extends EntityBullet { protected void explode() { this.setDead(); - this.worldObj.newExplosion(this.shooter == null ? this : this.shooter, this.posX, this.posY, this.posZ, (float)this.damage, this.flames, true, false); + this.worldObj.newExplosion(this, this.posX, this.posY, this.posZ, (float)this.damage, this.flames, true, false); } protected void onHitBlock(BlockPos pos) { diff --git a/common/src/main/java/common/init/BlockRegistry.java b/common/src/main/java/common/init/BlockRegistry.java index b1118f41..1f23d782 100755 --- a/common/src/main/java/common/init/BlockRegistry.java +++ b/common/src/main/java/common/init/BlockRegistry.java @@ -107,10 +107,8 @@ import common.block.tech.BlockEnchantmentTable; import common.block.tech.BlockFurnace; import common.block.tech.BlockHopper; import common.block.tech.BlockInactiveDisplay; -import common.block.tech.BlockJukebox; import common.block.tech.BlockLever; import common.block.tech.BlockMobSpawner; -import common.block.tech.BlockNote; import common.block.tech.BlockNuke; import common.block.tech.BlockPistonBase; import common.block.tech.BlockPistonHead; @@ -618,8 +616,6 @@ public abstract class BlockRegistry { register("brewing_stand", (new BlockBrewingStand()).setHardness(0.5F).setLightLevel(0.125F).setDisplay("Braustand")); register("cauldron", (new BlockCauldron()).setHardness(2.0F).setDisplay("Kessel")); register("effect_generator", (new BlockEffectGenerator()).setDisplay("Effektgenerator").setLightLevel(1.0F)); - register("noteblock", (new BlockNote()).setHardness(0.8F).setDisplay("Notenblock")); - register("jukebox", (new BlockJukebox()).setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.STONE).setDisplay("Plattenspieler")); register("construction_table", (new BlockWorkbench(4)).setHardness(2.5F).setStepSound(SoundType.WOOD).setDisplay("Konstruktionstisch")); register("assembly_unit", (new BlockWorkbench(5)).setHardness(2.5F).setStepSound(SoundType.WOOD).setDisplay("Fertigungseinheit")); @@ -629,8 +625,8 @@ public abstract class BlockRegistry { register("xxlarge_chest", new BlockChest(16, 10).setDisplay("Große Truhe")); register("xxxlarge_chest", new BlockChest(18, 14).setDisplay("Große Truhe")); register("huge_chest", new BlockChest(22, 18).setDisplay("Große Truhe")); - register("giant_chest", new BlockChest(24, 20).setDisplay("Große Truhe")); - register("toolarge_chest", new BlockChest(24, 24).setDisplay("Große Truhe")); + register("giant_chest", new BlockChest(28, 18).setDisplay("Große Truhe")); + register("toolarge_chest", new BlockChest(32, 18).setDisplay("Große Truhe")); register("warp_chest", (new BlockWarpChest()).setHardness(22.5F).setResistance(1000.0F).setStepSound(SoundType.STONE) .setDisplay("Warptruhe").setLightLevel(0.5F)); diff --git a/common/src/main/java/common/init/Blocks.java b/common/src/main/java/common/init/Blocks.java index e0d86b45..f1edf0b1 100755 --- a/common/src/main/java/common/init/Blocks.java +++ b/common/src/main/java/common/init/Blocks.java @@ -277,7 +277,6 @@ public abstract class Blocks { public static final BlockDoor iron_door = get("iron_door"); public static final BlockOre iron_ore = get("iron_ore"); public static final BlockTrapDoor iron_trapdoor = get("iron_trapdoor"); - public static final BlockJukebox jukebox = get("jukebox"); public static final BlockDoor jungle_door = get("jungle_door"); public static final BlockFence jungle_fence = get("jungle_fence"); public static final BlockFenceGate jungle_fence_gate = get("jungle_fence_gate"); @@ -359,7 +358,6 @@ public abstract class Blocks { public static final BlockOre nichun_ore = get("nichun_ore"); public static final Block nickel_block = get("nickel_block"); public static final BlockOre nickel_ore = get("nickel_ore"); - public static final BlockNote noteblock = get("noteblock"); public static final BlockStaticLiquid nukage = get("nukage"); public static final BlockNuke nuke = get("nuke"); public static final BlockDoor oak_door = get("oak_door"); diff --git a/common/src/main/java/common/init/CraftingRegistry.java b/common/src/main/java/common/init/CraftingRegistry.java index 4848fe70..7243c871 100755 --- a/common/src/main/java/common/init/CraftingRegistry.java +++ b/common/src/main/java/common/init/CraftingRegistry.java @@ -226,8 +226,6 @@ public abstract class CraftingRegistry add(new ItemStack(Items.assembly_unit), "----", "XXXX", "X##X", '#', Items.construction_table, '-', Items.titanium_ingot, 'X', planks); - add(new ItemStack(Items.jukebox, 1), "###", "#X#", "###", '#', planks, 'X', Items.diamond); - add(new ItemStack(Items.noteblock, 1), "###", "#X#", "###", '#', planks, 'X', Items.redstone); add(new ItemStack(Items.bookshelf, 1), "###", "XXX", "###", '#', planks, 'X', Items.book); add(new ItemStack(Items.trapdoor, 2), "###", "###", '#', planks); add(new ItemStack(Items.sign, 3), "###", "###", " X ", '#', planks, 'X', Items.stick); diff --git a/common/src/main/java/common/init/Items.java b/common/src/main/java/common/init/Items.java index 3646b76d..355e9839 100755 --- a/common/src/main/java/common/init/Items.java +++ b/common/src/main/java/common/init/Items.java @@ -458,7 +458,6 @@ public abstract class Items { public static final ItemShovel iron_shovel = get("iron_shovel"); public static final ItemSword iron_sword = get("iron_sword"); public static final ItemBlock iron_trapdoor = get("iron_trapdoor"); - public static final ItemBlock jukebox = get("jukebox"); public static final ItemDoor jungle_door = get("jungle_door"); public static final ItemFence jungle_fence = get("jungle_fence"); public static final ItemBlock jungle_fence_gate = get("jungle_fence_gate"); @@ -575,7 +574,6 @@ public abstract class Items { public static final ItemMetal nickel_ingot = get("nickel_ingot"); public static final ItemMetalBlock nickel_ore = get("nickel_ore"); public static final Item nieh_fragment = get("nieh_fragment"); - public static final ItemBlock noteblock = get("noteblock"); public static final ItemBucket nukage_bucket = get("nukage_bucket"); public static final ItemBlock nuke = get("nuke"); public static final ItemDoor oak_door = get("oak_door"); diff --git a/common/src/main/java/common/inventory/ContainerChest.java b/common/src/main/java/common/inventory/ContainerChest.java index eedae4e8..9ffdd6bb 100755 --- a/common/src/main/java/common/inventory/ContainerChest.java +++ b/common/src/main/java/common/inventory/ContainerChest.java @@ -26,7 +26,7 @@ public class ContainerChest extends Container { for (int k = 0; k < this.width; ++k) { - this.addSlotToContainer(new Slot(chest, k + j * 9, 8 + k * 18, 18 + j * 18)); + this.addSlotToContainer(new Slot(chest, k + j * this.width, 8 + k * 18, 18 + j * 18)); } } diff --git a/common/src/main/java/common/tileentity/DeviceEffectGenerator.java b/common/src/main/java/common/tileentity/DeviceEffectGenerator.java index 76176bf6..83272011 100755 --- a/common/src/main/java/common/tileentity/DeviceEffectGenerator.java +++ b/common/src/main/java/common/tileentity/DeviceEffectGenerator.java @@ -3,7 +3,7 @@ package common.tileentity; import java.util.List; import common.effect.StatusEffect; -import common.entity.types.EntityLiving; +import common.entity.npc.EntityNPC; import common.init.Items; import common.inventory.ContainerTile; import common.item.ItemStack; @@ -24,7 +24,7 @@ public class DeviceEffectGenerator extends Device { if(!this.hasAmount(0, 1) || !this.hasAmount(1, 1) || !(this.getStackInSlot(0).getItem() instanceof ItemPotion potion)) return false; StatusEffect effect = potion.getEffect(); - if(effect == null) + if(effect == null || !this.hasAmount(1, effect.getAmplifier() + 1)) return false; int levels = 4; // TODO: energy + selector (MachineControl) double r = (double)(levels * 10 + 10); @@ -32,9 +32,14 @@ public class DeviceEffectGenerator extends Device { double y = this.pos.getY(); double z = this.pos.getZ(); BoundingBox bb = new BoundingBox(x + 0.5 - r, y - 16.0, z + 0.5 - r, x + 0.5 + r, (double)World.MAX_SIZE_Y, z + 0.5 + r); - List list = this.worldObj.getEntitiesWithinAABB(EntityLiving.class, bb); - for(EntityLiving entity : list) { - entity.addEffect(new StatusEffect(effect.getPotion(), 180, effect.getAmplifier())); + List list = this.worldObj.getEntitiesWithinAABB(EntityNPC.class, bb); + for(EntityNPC entity : list) { + if(!entity.hasEffect(effect.getPotion()) || entity.getEffect(effect.getPotion()).getAmplifier() < effect.getAmplifier() || entity.getEffect(effect.getPotion()).getRemaining() < 40) { + entity.addEffect(new StatusEffect(effect.getPotion(), 180, effect.getAmplifier())); + this.decrStackSize(1, effect.getAmplifier() + 1); + if(!this.hasAmount(1, effect.getAmplifier() + 1)) + break; + } } return true; } diff --git a/common/src/main/java/common/tileentity/TileEntityChest.java b/common/src/main/java/common/tileentity/TileEntityChest.java index 048cf7d9..555921e8 100755 --- a/common/src/main/java/common/tileentity/TileEntityChest.java +++ b/common/src/main/java/common/tileentity/TileEntityChest.java @@ -136,7 +136,7 @@ public class TileEntityChest extends TileEntity implements ITickable, IInventory for (int i = 0; i < nbttaglist.size(); ++i) { TagObject nbttagcompound = nbttaglist.get(i); - int j = nbttagcompound.getByte("Slot") & 255; + int j = nbttagcompound.getShort("Slot"); if (j >= 0 && j < this.chestContents.length) { @@ -157,7 +157,7 @@ public class TileEntityChest extends TileEntity implements ITickable, IInventory if (this.chestContents[i] != null) { TagObject nbttagcompound = new TagObject(); - nbttagcompound.setByte("Slot", (byte)i); + nbttagcompound.setShort("Slot", (short)i); this.chestContents[i].writeTags(nbttagcompound); nbttaglist.add(nbttagcompound); } diff --git a/common/src/main/java/common/world/Explosion.java b/common/src/main/java/common/world/Explosion.java index 4be79ef4..7e7c7eb7 100755 --- a/common/src/main/java/common/world/Explosion.java +++ b/common/src/main/java/common/world/Explosion.java @@ -13,6 +13,7 @@ import common.entity.DamageSource; import common.entity.Entity; import common.entity.item.EntityTnt; import common.entity.npc.EntityNPC; +import common.entity.projectile.EntityMissile; import common.entity.types.EntityLiving; import common.init.Blocks; import common.init.SoundEvent; @@ -355,12 +356,10 @@ public class Explosion return this.playerKnockbackMap; } - /** - * Returns either the entity that placed the explosive block, the entity that caused the explosion or null. - */ public EntityLiving getExplosivePlacedBy() { - return this.exploder == null ? null : (this.exploder instanceof EntityTnt ? ((EntityTnt)this.exploder).getTntPlacedBy() : (this.exploder instanceof EntityLiving ? (EntityLiving)this.exploder : null)); + return this.exploder == null ? null : (this.exploder instanceof EntityTnt ? ((EntityTnt)this.exploder).getTntPlacedBy() : + (this.exploder instanceof EntityMissile missile && missile.getShooter() instanceof EntityLiving shooter ? shooter :(this.exploder instanceof EntityLiving ? (EntityLiving)this.exploder : null))); } public void clearAffectedBlockPositions() diff --git a/common/src/main/java/common/world/World.java b/common/src/main/java/common/world/World.java index 39cb1070..dad7b6db 100755 --- a/common/src/main/java/common/world/World.java +++ b/common/src/main/java/common/world/World.java @@ -238,7 +238,7 @@ public abstract class World implements IWorldAccess { if(!this.client && (flags & 1) != 0) { this.notifyNeighborsOfStateChange(pos, iblockstate.getBlock()); - if(block.hasComparatorInputOverride()) { + if(block.hasSignalProcessing()) { this.updateComparatorOutputLevel(pos, block); } } @@ -1840,7 +1840,7 @@ public abstract class World implements IWorldAccess { return iblockstate.getBlock().getStrongPower(this, pos, iblockstate, direction); } - public int getStrongPower(BlockPos pos) { + private int getStrongPower(BlockPos pos) { int i = 0; i = Math.max(i, this.getStrongPower(pos.down(), Facing.DOWN)); diff --git a/server/src/main/java/server/world/Converter.java b/server/src/main/java/server/world/Converter.java index e04d6328..9ef07465 100644 --- a/server/src/main/java/server/world/Converter.java +++ b/server/src/main/java/server/world/Converter.java @@ -494,7 +494,7 @@ public abstract class Converter { mapBlock(Blocks.sandstone, 24); mapBlock(Blocks.carved_sandstone, 24, 1); mapBlock(Blocks.smooth_sandstone, 24, 2); - mapBlock(Blocks.noteblock, 25); + mapBlock(Blocks.spruce_planks, 25); mapBlock(Blocks.red_bed.getState().withProperty(BlockBed.FACING, Facing.SOUTH).withProperty(BlockBed.PART, EnumPartType.FOOT), 26, 0, 4); mapBlock(Blocks.red_bed.getState().withProperty(BlockBed.FACING, Facing.WEST).withProperty(BlockBed.PART, EnumPartType.FOOT), 26, 1, 5); mapBlock(Blocks.red_bed.getState().withProperty(BlockBed.FACING, Facing.NORTH).withProperty(BlockBed.PART, EnumPartType.FOOT), 26, 2, 6); @@ -841,7 +841,7 @@ public abstract class Converter { mapBlock(Blocks.reeds.getState().withProperty(BlockReed.AGE, 13), 83, 13); mapBlock(Blocks.reeds.getState().withProperty(BlockReed.AGE, 14), 83, 14); mapBlock(Blocks.reeds.getState().withProperty(BlockReed.AGE, 15), 83, 15); - mapBlock(Blocks.jukebox, 84); + mapBlock(Blocks.spruce_planks, 84); mapBlock(Blocks.oak_fence, 85); mapBlock(Blocks.pumpkin.getState().withProperty(BlockPumpkin.FACING, Facing.SOUTH), 86, 0, 4, 8, 12); mapBlock(Blocks.pumpkin.getState().withProperty(BlockPumpkin.FACING, Facing.WEST), 86, 1, 5, 9, 13);