Compare commits

...
22 Commits
Author SHA1 Message Date
DreamMasterXXL d4330b1512 bump version 2020-12-16 00:14:01 +01:00
Martin Robertz 53c72a9397 Merge pull request #7 from Skiftcha/chisel-gui-scroll
Chisel gui scroll
2020-12-16 00:06:22 +01:00
Skiftcha f728eb1a15 fix scrolling issues due to container updates from server 2020-11-24 17:29:26 +03:00
Skiftcha 48f5e6fec2 disable chiseling by scrolling over itemstack 2020-11-24 17:28:56 +03:00
Skiftcha 346a818a5a small cleanup 2020-11-24 09:26:33 +03:00
Skiftcha 587afa8e1d adjust scrolling 2020-11-24 09:10:48 +03:00
Skiftcha 3ae2128564 sync with server 2020-11-24 08:21:52 +03:00
Skiftcha 8c82d0fa41 local scrolling 2020-11-24 08:06:51 +03:00
Prometheus0000 acdd403636 fix name 2020-10-31 14:43:22 -04:00
Martin Robertz 6916e91591 Merge pull request #6 from Prometheus0000/add-chisel
Add more durable chisel
2020-10-31 08:29:28 +01:00
Prometheus0000000 06dadab7de Add more durable chisel 2020-10-31 00:50:22 -04:00
Martin Robertz aed35c359e Merge pull request #4 from glowredman/1.7/release
Add some localizations
2020-10-11 15:59:03 +02:00
Martin Robertz 0b6a55c16c Merge pull request #5 from Prometheus0000/1.7/release
Remove chiseling to 2nd type of arcane stone
2020-10-11 12:13:58 +02:00
Prometheus0000 1ff93570da Remove chiseling to 2nd type 2020-10-10 21:26:34 -04:00
glowredman ce290e5e24 Add missing localizations (en_US) 2020-10-11 02:06:27 +02:00
glowredman 706a6cae90 Add missing localizations (en_PT) 2020-10-11 02:02:11 +02:00
glowredman 88118d11a3 Add missing localizations (en_GB) 2020-10-11 01:59:58 +02:00
glowredman c3f77411b0 Add missing localizations (de_DE) 2020-10-11 01:57:56 +02:00
DreamMasterXXL f5aaf31a8d bump version 2020-05-24 16:18:50 +02:00
Martin Robertz a239e7b44f Merge pull request #3 from Kiwi233/1.7/release
Update zh_CN.lang
2020-05-24 13:25:56 +02:00
[Kiwi233] 2f7c6e9e39 Update zh_CN.lang 2020-05-24 19:21:16 +08:00
Dream-Master dee61e51cd update gradle 2020-04-10 15:01:23 +02:00
18 changed files with 888 additions and 629 deletions

No files matched your search

+2 -2
View File
@@ -1,6 +1,6 @@
mod_version=2.9.7-GTNH mod_version=1.7.10-2.9.9-GTNH
minecraft_version=1.7.10 minecraft_version=1.7.10
forge_version=10.13.4.1481-1.7.10 forge_version=10.13.4.1614-1.7.10
ctmlib_version=MC1.7.10-1.4.1.5 ctmlib_version=MC1.7.10-1.4.1.5
ccl_version=1.1.3.140 ccl_version=1.1.3.140
+5 -1
View File
@@ -196,7 +196,7 @@ public enum Features {
void addBlocks() { void addBlocks() {
BlockCarvable arcane = (BlockCarvable) new BlockCarvable(Material.rock).setCreativeTab(ChiselTabs.tabModdedChiselBlocks).setStepSound(Block.soundTypeStone); BlockCarvable arcane = (BlockCarvable) new BlockCarvable(Material.rock).setCreativeTab(ChiselTabs.tabModdedChiselBlocks).setStepSound(Block.soundTypeStone);
Carving.chisel.addVariation("arcane", GameRegistry.findBlock("Thaumcraft", "blockCosmeticSolid"), 6, -5); Carving.chisel.addVariation("arcane", GameRegistry.findBlock("Thaumcraft", "blockCosmeticSolid"), 6, -5);
Carving.chisel.addVariation("arcane", GameRegistry.findBlock("Thaumcraft", "blockCosmeticSolid"), 7, -4); // Carving.chisel.addVariation("arcane", GameRegistry.findBlock("Thaumcraft", "blockCosmeticSolid"), 7, -4);
arcane.carverHelper.addVariation("tile.arcane.0.desc", 0, "arcane/moonEngrave"); arcane.carverHelper.addVariation("tile.arcane.0.desc", 0, "arcane/moonEngrave");
arcane.carverHelper.addVariation("tile.arcane.1.desc", 1, "arcane/moonGlowAnim"); arcane.carverHelper.addVariation("tile.arcane.1.desc", 1, "arcane/moonGlowAnim");
arcane.carverHelper.addVariation("tile.arcane.2.desc", 2, "arcane/arcaneTile"); arcane.carverHelper.addVariation("tile.arcane.2.desc", 2, "arcane/arcaneTile");
@@ -461,9 +461,11 @@ public enum Features {
ItemChisel chisel = (ItemChisel) new ItemChisel(ItemChisel.ChiselType.IRON).setCreativeTab(ChiselTabs.tabChisel); ItemChisel chisel = (ItemChisel) new ItemChisel(ItemChisel.ChiselType.IRON).setCreativeTab(ChiselTabs.tabChisel);
ItemChisel diamondChisel = (ItemChisel) new ItemChisel(ItemChisel.ChiselType.DIAMOND).setCreativeTab(ChiselTabs.tabChisel); ItemChisel diamondChisel = (ItemChisel) new ItemChisel(ItemChisel.ChiselType.DIAMOND).setCreativeTab(ChiselTabs.tabChisel);
ItemChisel obsidianChisel = (ItemChisel) new ItemChisel(ItemChisel.ChiselType.OBSIDIAN).setCreativeTab(ChiselTabs.tabChisel); ItemChisel obsidianChisel = (ItemChisel) new ItemChisel(ItemChisel.ChiselType.OBSIDIAN).setCreativeTab(ChiselTabs.tabChisel);
ItemChisel netherStarChisel = (ItemChisel) new ItemChisel(ItemChisel.ChiselType.NETHERSTAR).setCreativeTab(ChiselTabs.tabChisel);
GameRegistry.registerItem(chisel, "chisel"); GameRegistry.registerItem(chisel, "chisel");
GameRegistry.registerItem(diamondChisel, "diamondChisel"); GameRegistry.registerItem(diamondChisel, "diamondChisel");
GameRegistry.registerItem(obsidianChisel, "obsidianChisel"); GameRegistry.registerItem(obsidianChisel, "obsidianChisel");
GameRegistry.registerItem(netherStarChisel, "netherStarChisel");
} }
@Override @Override
@@ -472,10 +474,12 @@ public enum Features {
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ChiselItems.chisel), " YY", " YY", "X ", 'X', "stickWood", 'Y', "ingotIron")); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ChiselItems.chisel), " YY", " YY", "X ", 'X', "stickWood", 'Y', "ingotIron"));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ChiselItems.diamondChisel), " YY", " YY", "x ", 'x', "stickWood", 'Y', "gemDiamond")); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ChiselItems.diamondChisel), " YY", " YY", "x ", 'x', "stickWood", 'Y', "gemDiamond"));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ChiselItems.obsidianChisel), " YY", " YY", "x ", 'x', "stickWood", 'Y', Blocks.obsidian)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ChiselItems.obsidianChisel), " YY", " YY", "x ", 'x', "stickWood", 'Y', Blocks.obsidian));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ChiselItems.netherStarChisel), " YY", " YY", "x ", 'x', "stickWood", 'Y', "netherStar"));
} else { } else {
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ChiselItems.chisel), " Y", "X ", 'X', "stickWood", 'Y', "ingotIron")); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ChiselItems.chisel), " Y", "X ", 'X', "stickWood", 'Y', "ingotIron"));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ChiselItems.diamondChisel), " Y", "X ", 'X', "stickWood", 'Y', "gemDiamond")); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ChiselItems.diamondChisel), " Y", "X ", 'X', "stickWood", 'Y', "gemDiamond"));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ChiselItems.obsidianChisel), " Y", "X ", 'X', "stickWood", 'Y', Blocks.obsidian)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ChiselItems.obsidianChisel), " Y", "X ", 'X', "stickWood", 'Y', Blocks.obsidian));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ChiselItems.netherStarChisel), " YY", " YY", "x ", 'x', "stickWood", 'Y', "netherStar"));
} }
} }
}, },
@@ -13,6 +13,7 @@ import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot; import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
import team.chisel.client.gui.widgets.GuiButtonChiselMode; import team.chisel.client.gui.widgets.GuiButtonChiselMode;
import team.chisel.inventory.ContainerChisel; import team.chisel.inventory.ContainerChisel;
@@ -28,116 +29,149 @@ import static team.chisel.Chisel.MOD_ID;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public class GuiChisel extends GuiContainer { public class GuiChisel extends GuiContainer {
public static final ResourceLocation TEXTURE_RESOURCE_LOCATION = new ResourceLocation(MOD_ID, "textures/chisel2GuiScroll.png"); public static final ResourceLocation TEXTURE_RESOURCE_LOCATION = new ResourceLocation(MOD_ID, "textures/chisel2GuiScroll.png");
public static final int TEXTURE_WIDTH = 266; public static final int TEXTURE_WIDTH = 266;
public static final int TEXTURE_HEIGHT = 250; public static final int TEXTURE_HEIGHT = 250;
public static final int GUI_WIDTH = 266; public static final int GUI_WIDTH = 266;
public static final int GUI_HEIGHT = 202; public static final int GUI_HEIGHT = 202;
public static final int CHISEL_INPUT_SIZE = 48; public static final int CHISEL_INPUT_SIZE = 48;
private EntityPlayer player; private EntityPlayer player;
private ContainerChisel container; private ContainerChisel container;
private IChiselMode currentMode; private IChiselMode currentMode;
private GuiScrollbar scrollBar;
private InventoryChiselSelection menu;
public GuiChisel(InventoryPlayer iinventory, InventoryChiselSelection menu) { public GuiChisel(InventoryPlayer iinventory, InventoryChiselSelection menu) {
super(new ContainerChisel(iinventory, menu)); super(new ContainerChisel(iinventory, menu));
player = iinventory.player; scrollBar = new GuiScrollbar();
xSize = GUI_WIDTH; this.menu = menu;
ySize = GUI_HEIGHT; player = iinventory.player;
xSize = GUI_WIDTH;
ySize = GUI_HEIGHT;
container = (ContainerChisel) inventorySlots; container = (ContainerChisel) inventorySlots;
} scrollBar.setContainerChisel(container);
}
@Override @Override
public void onGuiClosed() { public void onGuiClosed() {
super.onGuiClosed(); super.onGuiClosed();
inventorySlots.onContainerClosed(player); inventorySlots.onContainerClosed(player);
} }
@Override @Override
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public void initGui() { public void initGui() {
super.initGui(); super.initGui();
currentMode = General.getChiselMode(container.chisel); currentMode = General.getChiselMode(container.chisel);
if (showMode()) { if (showMode()) {
buttonList.add(new GuiButtonChiselMode(0, guiLeft + 12, guiTop + 132, this)); buttonList.add(new GuiButtonChiselMode(0, guiLeft + 12, guiTop + 132, this));
} }
}
@Override scrollBar.setLeft(246);
public void updateScreen() { scrollBar.setTop(8);
super.updateScreen(); scrollBar.setScrollHeight(106);
final ItemStack held = player.getCurrentEquippedItem(); }
if (held == null || !(held.getItem() instanceof IChiselItem)) {
mc.displayGuiScreen(null);
}
}
private boolean showMode() { @Override
return container.chisel != null public void updateScreen() {
&& container.chisel.getItem() instanceof IChiselItem super.updateScreen();
&& ((IChiselItem) container.chisel.getItem()).hasModes(container.chisel); final ItemStack held = player.getCurrentEquippedItem();
} if (held == null || !(held.getItem() instanceof IChiselItem)) {
mc.displayGuiScreen(null);
}
}
@Override private boolean showMode() {
protected void drawGuiContainerForegroundLayer(final int mouseX, final int mouseY) { return container.chisel != null
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); && container.chisel.getItem() instanceof IChiselItem
&& ((IChiselItem) container.chisel.getItem()).hasModes(container.chisel);
}
final String titleText = I18n.format(container.inventory.getInventoryName() + ".title"); @Override
fontRendererObj.drawSplitString(titleText, 50 - fontRendererObj.getStringWidth(titleText) / 2, 60, 40, 0x404040); protected void drawGuiContainerForegroundLayer(final int mouseX, final int mouseY) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
if (showMode()) { final String titleText = I18n.format(container.inventory.getInventoryName() + ".title");
final String modeText = I18n.format(container.inventory.getInventoryName() + ".mode"); fontRendererObj.drawSplitString(titleText, 50 - fontRendererObj.getStringWidth(titleText) / 2, 60, 40, 0x404040);
fontRendererObj.drawString(modeText, 12 + (GuiButtonChiselMode.BUTTON_WIDTH - fontRendererObj.getStringWidth(modeText)) / 2, 122, 0x404040);
}
}
@Override if (showMode()) {
protected void drawGuiContainerBackgroundLayer(final float partialTicks, final int mouseX, final int mouseY) { final String modeText = I18n.format(container.inventory.getInventoryName() + ".mode");
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); fontRendererObj.drawString(modeText, 12 + (GuiButtonChiselMode.BUTTON_WIDTH - fontRendererObj.getStringWidth(modeText)) / 2, 122, 0x404040);
GL11.glDisable(GL11.GL_LIGHTING); }
mc.getTextureManager().bindTexture(TEXTURE_RESOURCE_LOCATION); scrollBar.draw(this);
// drawModalRectWithCustomSizedTexture: x, y, u, v, width, height, textureWidth, textureHeight }
func_146110_a(guiLeft, guiTop, 0, 0, xSize, ySize, TEXTURE_WIDTH, TEXTURE_HEIGHT);
Slot main = (Slot) container.inventorySlots.get(InventoryChiselSelection.normalSlots); @Override
if (main.getStack() == null) { protected void drawGuiContainerBackgroundLayer(final float partialTicks, final int mouseX, final int mouseY) {
func_146110_a(guiLeft + 8, guiTop + 8, 0, GUI_HEIGHT, CHISEL_INPUT_SIZE, CHISEL_INPUT_SIZE, TEXTURE_WIDTH, TEXTURE_HEIGHT); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
} GL11.glDisable(GL11.GL_LIGHTING);
}
@Override mc.getTextureManager().bindTexture(TEXTURE_RESOURCE_LOCATION);
protected void actionPerformed(final GuiButton button) { // drawModalRectWithCustomSizedTexture: x, y, u, v, width, height, textureWidth, textureHeight
if (button.id == 0) { func_146110_a(guiLeft, guiTop, 0, 0, xSize, ySize, TEXTURE_WIDTH, TEXTURE_HEIGHT);
if (container.chisel != null && container.chisel.getItem() instanceof IAdvancedChisel) {
final IAdvancedChisel item = (IAdvancedChisel) container.chisel.getItem();
currentMode = item.getNextMode(container.chisel, currentMode);
} else {
currentMode = ChiselMode.next(currentMode);
}
PacketHandler.INSTANCE.sendToServer(new MessageChiselMode(currentMode));
}
super.actionPerformed(button);
}
@Override Slot main = (Slot) container.inventorySlots.get(InventoryChiselSelection.normalSlots);
protected void func_146977_a(final Slot slot) { if (main.getStack() == null) {
if (slot instanceof SlotChiselInput) { func_146110_a(guiLeft + 8, guiTop + 8, 0, GUI_HEIGHT, CHISEL_INPUT_SIZE, CHISEL_INPUT_SIZE, TEXTURE_WIDTH, TEXTURE_HEIGHT);
GL11.glPushMatrix(); }
GL11.glScalef(2, 2, 2); }
slot.xDisplayPosition -= 16;
slot.yDisplayPosition -= 16;
super.func_146977_a(slot);
slot.xDisplayPosition += 16;
slot.yDisplayPosition += 16;
GL11.glPopMatrix();
} else {
super.func_146977_a(slot);
}
}
public IChiselMode getCurrentMode() { @Override
return currentMode; protected void actionPerformed(final GuiButton button) {
} if (button.id == 0) {
if (container.chisel != null && container.chisel.getItem() instanceof IAdvancedChisel) {
final IAdvancedChisel item = (IAdvancedChisel) container.chisel.getItem();
currentMode = item.getNextMode(container.chisel, currentMode);
} else {
currentMode = ChiselMode.next(currentMode);
}
PacketHandler.INSTANCE.sendToServer(new MessageChiselMode(currentMode));
}
super.actionPerformed(button);
}
@Override
protected void func_146977_a(final Slot slot) {
if (slot instanceof SlotChiselInput) {
GL11.glPushMatrix();
GL11.glScalef(2, 2, 2);
slot.xDisplayPosition -= 16;
slot.yDisplayPosition -= 16;
super.func_146977_a(slot);
slot.xDisplayPosition += 16;
slot.yDisplayPosition += 16;
GL11.glPopMatrix();
} else {
super.func_146977_a(slot);
}
}
@Override
protected void mouseClickMove(int x, int y, int c, long d) {
scrollBar.click(x - guiLeft, y - guiTop);
super.mouseClickMove(x, y, c, d);
}
@Override
protected void mouseClicked(int xCoord, int yCoord, int btn) {
scrollBar.click(xCoord - guiLeft, yCoord - guiTop);
super.mouseClicked(xCoord, yCoord, btn);
}
@Override
public void handleMouseInput() {
super.handleMouseInput();
int i = Mouse.getEventDWheel();
if (i != 0 && scrollBar != null) {
scrollBar.wheel(i);
}
}
public IChiselMode getCurrentMode() {
return currentMode;
}
} }
@@ -0,0 +1,95 @@
package team.chisel.client.gui;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import team.chisel.inventory.ContainerChisel;
import team.chisel.network.PacketHandler;
import team.chisel.network.message.MessageScrollUpdate;
public class GuiScrollbar {
public static final ResourceLocation TEXTURE_RESOURCE_LOCATION = new ResourceLocation("minecraft", "textures/gui/container/creative_inventory/tabs.png");
private int displayX = 0;
private int displayY = 0;
private int width = 12;
private int height = 15;
private int rowSize = 10;
private int rowsOnPage = 6;
private int scrollHeight = height;
private ContainerChisel container;
public void draw(GuiChisel g) {
// chisel2GuiScroll scroll button texture coordinates work strange (maybe because of alignment) so taking vanilla one
g.mc.getTextureManager().bindTexture(TEXTURE_RESOURCE_LOCATION);
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
if (getMaxScroll() == 0) {
g.drawTexturedModalRect(displayX, displayY, 232 + width, 0, width, height);
} else {
int offset = getCurrentScroll() * (scrollHeight - height) / getMaxScroll();
g.drawTexturedModalRect(displayX, offset + displayY, 232, 0, width, height);
}
}
public GuiScrollbar setScrollHeight(int scrollHeight) {
this.scrollHeight = scrollHeight;
return this;
}
public GuiScrollbar setLeft(int displayX) {
this.displayX = displayX;
return this;
}
public GuiScrollbar setTop(int displayY) {
this.displayY = displayY;
return this;
}
private int getMaxScroll() {
int maxScroll = (container.inventory.getMaxScroll() + rowSize - 1) / rowSize - rowsOnPage;
if (maxScroll <= 0) {
maxScroll = 0;
}
return maxScroll;
}
public int getCurrentScroll() {
return container.inventory.getCurrentScroll() / rowSize;
}
private void setCurrentScroll(int scroll) {
container.inventory.setCurrentScroll(scroll * rowSize);
PacketHandler.INSTANCE.sendToServer(new MessageScrollUpdate(scroll * rowSize));
}
private int applyRange(int scroll) {
return Math.max(Math.min(scroll, getMaxScroll()), 0);
}
void click(int x, int y) {
if (getMaxScroll() == 0) {
return;
}
if (x > displayX && x <= displayX + width) {
if (y > displayY && y <= displayY + scrollHeight) {
int currentScroll = (y - displayY - height / 2);
currentScroll = Math.round(1.0f * currentScroll * getMaxScroll() / (scrollHeight - height));
setCurrentScroll(applyRange(currentScroll));
}
}
}
void wheel(int delta) {
setCurrentScroll(applyRange(getCurrentScroll() + Math.max(Math.min(-delta, 1), -1)));
}
public void setContainerChisel(ContainerChisel container) {
this.container = container;
}
}
@@ -5,9 +5,11 @@ import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import codechicken.nei.api.GuiInfo;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import team.chisel.carving.Carving; import team.chisel.carving.Carving;
import team.chisel.client.gui.GuiChisel;
import team.chisel.utils.RecipeUtil; import team.chisel.utils.RecipeUtil;
import com.cricketcraft.chisel.api.carving.ICarvingGroup; import com.cricketcraft.chisel.api.carving.ICarvingGroup;
@@ -86,6 +88,10 @@ public class Compatibility {
if (Loader.isModLoaded("EE3")) { if (Loader.isModLoaded("EE3")) {
loadEE3Values(); loadEE3Values();
} }
if (Loader.isModLoaded("NotEnoughItems")) {
// disable chiseling by scrolling over itemstack
GuiInfo.customSlotGuis.add(GuiChisel.class);
}
} }
@@ -44,11 +44,13 @@ public class Configurations {
public static int ironChiselMaxDamage; public static int ironChiselMaxDamage;
public static int diamondChiselMaxDamage; public static int diamondChiselMaxDamage;
public static int obsidianChiselMaxDamage; public static int obsidianChiselMaxDamage;
public static int netherStarChiselMaxDamage;
public static boolean ironChiselCanLeftClick; public static boolean ironChiselCanLeftClick;
public static boolean ironChiselHasModes; public static boolean ironChiselHasModes;
public static int ironChiselAttackDamage; public static int ironChiselAttackDamage;
public static int diamondChiselAttackDamage; public static int diamondChiselAttackDamage;
public static int obsidianChiselAttackDamage; public static int obsidianChiselAttackDamage;
public static int netherStarChiselAttackDamage;
public static boolean allowChiselCrossColors; public static boolean allowChiselCrossColors;
public static boolean useRoadLineTool; public static boolean useRoadLineTool;
@@ -102,6 +104,7 @@ public class Configurations {
ironChiselMaxDamage = config.getInt("ironChiselMaxDamage", category, 500, 1, Short.MAX_VALUE, "The max damage of the standard iron chisel."); ironChiselMaxDamage = config.getInt("ironChiselMaxDamage", category, 500, 1, Short.MAX_VALUE, "The max damage of the standard iron chisel.");
diamondChiselMaxDamage = config.getInt("diamondChiselMaxDamage", category, 5000, 1, Short.MAX_VALUE, "The max damage of the diamond chisel."); diamondChiselMaxDamage = config.getInt("diamondChiselMaxDamage", category, 5000, 1, Short.MAX_VALUE, "The max damage of the diamond chisel.");
obsidianChiselMaxDamage = config.getInt("obsidianChiselMaxDamage", category, 2500, 1, Short.MAX_VALUE, "The max damage of the obsidian chisel."); obsidianChiselMaxDamage = config.getInt("obsidianChiselMaxDamage", category, 2500, 1, Short.MAX_VALUE, "The max damage of the obsidian chisel.");
netherStarChiselMaxDamage = config.getInt("netherStarChiselMaxDamage", category, 32767, 1, Short.MAX_VALUE, "The max damage of the nether star chisel.");
ironChiselCanLeftClick = config.get(category, "ironChiselCanLeftClick", true, "If this is true, the iron chisel can left click chisel blocks. If false, it cannot.").getBoolean(); ironChiselCanLeftClick = config.get(category, "ironChiselCanLeftClick", true, "If this is true, the iron chisel can left click chisel blocks. If false, it cannot.").getBoolean();
ironChiselHasModes = config.get(category, "ironChiselHasModes", false, "If this is true, the iron chisel can change its chisel mode just as the diamond chisel can.").getBoolean(); ironChiselHasModes = config.get(category, "ironChiselHasModes", false, "If this is true, the iron chisel can change its chisel mode just as the diamond chisel can.").getBoolean();
allowChiselCrossColors = config.get(category, "allowChiselCrossColors", true, "Should someone be able to chisel something into a different color.").getBoolean(); allowChiselCrossColors = config.get(category, "allowChiselCrossColors", true, "Should someone be able to chisel something into a different color.").getBoolean();
@@ -112,6 +115,8 @@ public class Configurations {
"The extra attack damage points (in half hearts) that the diamond chisel inflicts when it is used to attack an entity.").getInt(); "The extra attack damage points (in half hearts) that the diamond chisel inflicts when it is used to attack an entity.").getInt();
obsidianChiselAttackDamage = config.get(category, "obsidianChiselAttackDamage", 4, obsidianChiselAttackDamage = config.get(category, "obsidianChiselAttackDamage", 4,
"The extra attack damage points (in half hearts) that the obsidian chisel inflicts when it is used to attack an entity.").getInt(); "The extra attack damage points (in half hearts) that the obsidian chisel inflicts when it is used to attack an entity.").getInt();
netherStarChiselAttackDamage = config.get(category, "netherStarChiselAttackDamage", 6,
"The extra attack damage points (in half hearts) that the nether star chisel inflicts when it is used to attack an entity.").getInt();
/* block */ /* block */
category = "block"; category = "block";
@@ -14,6 +14,7 @@ public final class ChiselItems {
public static final ItemChisel chisel = null; public static final ItemChisel chisel = null;
public static final ItemChisel diamondChisel = null; public static final ItemChisel diamondChisel = null;
public static final ItemChisel obsidianChisel = null; public static final ItemChisel obsidianChisel = null;
public static final ItemChisel netherStarChisel = null;
public static final ItemCloudInABottle cloudinabottle = null; public static final ItemCloudInABottle cloudinabottle = null;
public static final ItemBallOMoss ballomoss = null; public static final ItemBallOMoss ballomoss = null;
public static final ItemSmashingRock smashingrock = null; public static final ItemSmashingRock smashingrock = null;
@@ -15,11 +15,12 @@ import net.minecraft.item.ItemTool;
public class InventoryChiselSelection implements IInventory { public class InventoryChiselSelection implements IInventory {
ItemStack chisel = null; ItemStack chisel;
public final static int normalSlots = 60; public final static int normalSlots = 60;
public int activeVariations = 0;
ContainerChisel container; ContainerChisel container;
ItemStack[] inventory; ItemStack[] inventory;
private int currentScroll = 0;
private int maxScroll = 0;
public InventoryChiselSelection(ItemStack c) { public InventoryChiselSelection(ItemStack c) {
super(); super();
@@ -28,6 +29,21 @@ public class InventoryChiselSelection implements IInventory {
chisel = c; chisel = c;
} }
public void setCurrentScroll(int currentScroll) {
if (this.currentScroll != currentScroll) {
this.currentScroll = currentScroll;
updateItems();
}
}
public int getCurrentScroll() {
return currentScroll;
}
public int getMaxScroll() {
return maxScroll;
}
public void onInventoryUpdate(int slot) { public void onInventoryUpdate(int slot) {
} }
@@ -95,10 +111,10 @@ public class InventoryChiselSelection implements IInventory {
} }
public void clearItems() { public void clearItems() {
activeVariations = 0;
for (int i = 0; i < normalSlots; i++) { for (int i = 0; i < normalSlots; i++) {
inventory[i] = null; inventory[i] = null;
} }
maxScroll = 0;
} }
public ItemStack getStackInSpecialSlot() { public ItemStack getStackInSpecialSlot() {
@@ -125,11 +141,11 @@ public class InventoryChiselSelection implements IInventory {
return; return;
List<ItemStack> list = container.carving.getItemsForChiseling(chiseledItem); List<ItemStack> list = container.carving.getItemsForChiseling(chiseledItem);
maxScroll = list.size();
activeVariations = 0; int activeVariations = 0;
while (activeVariations < normalSlots && activeVariations < list.size()) { while (activeVariations < normalSlots && activeVariations + currentScroll < list.size()) {
if (Block.blockRegistry.getNameForObject(Block.getBlockFromItem(list.get(activeVariations).getItem())) != null) { if (Block.blockRegistry.getNameForObject(Block.getBlockFromItem(list.get(activeVariations + currentScroll).getItem())) != null) {
inventory[activeVariations] = list.get(activeVariations); inventory[activeVariations] = list.get(activeVariations + currentScroll);
activeVariations++; activeVariations++;
} }
} }
@@ -151,8 +167,11 @@ public class InventoryChiselSelection implements IInventory {
@Override @Override
public void setInventorySlotContents(int slot, ItemStack stack) { public void setInventorySlotContents(int slot, ItemStack stack) {
inventory[slot] = stack; // we do not want external chisel variant updates
updateInventoryState(slot); if (slot == normalSlots) {
inventory[slot] = stack;
updateInventoryState(slot);
}
} }
@Override @Override
@@ -172,5 +191,4 @@ public class InventoryChiselSelection implements IInventory {
return !(stack != null && (stack.getItem() instanceof ItemChisel)) && i == normalSlots; return !(stack != null && (stack.getItem() instanceof ItemChisel)) && i == normalSlots;
} }
} }
@@ -30,6 +30,7 @@ public class SlotChiselInput extends Slot {
return; return;
super.onSlotChanged(); super.onSlotChanged();
selInventory.setCurrentScroll(0);
selInventory.updateItems(); selInventory.updateItems();
} }
@@ -30,7 +30,8 @@ public class ItemChisel extends Item implements IChiselItem {
public enum ChiselType { public enum ChiselType {
IRON(Configurations.ironChiselMaxDamage, Configurations.ironChiselAttackDamage), IRON(Configurations.ironChiselMaxDamage, Configurations.ironChiselAttackDamage),
DIAMOND(Configurations.diamondChiselMaxDamage, Configurations.diamondChiselAttackDamage), DIAMOND(Configurations.diamondChiselMaxDamage, Configurations.diamondChiselAttackDamage),
OBSIDIAN(Configurations.obsidianChiselMaxDamage, Configurations.obsidianChiselAttackDamage); OBSIDIAN(Configurations.obsidianChiselMaxDamage, Configurations.obsidianChiselAttackDamage),
NETHERSTAR(Configurations.netherStarChiselMaxDamage, Configurations.netherStarChiselAttackDamage);
final int maxDamage; final int maxDamage;
final int attackDamage; final int attackDamage;
@@ -74,8 +75,9 @@ public class ItemChisel extends Item implements IChiselItem {
return repairMaterial.getItem().equals(Items.iron_ingot); return repairMaterial.getItem().equals(Items.iron_ingot);
case OBSIDIAN: case OBSIDIAN:
return repairMaterial.getItem().equals(Item.getItemFromBlock(Blocks.obsidian)); return repairMaterial.getItem().equals(Item.getItemFromBlock(Blocks.obsidian));
case NETHERSTAR:
return repairMaterial.getItem().equals(Items.nether_star);
} }
return false; return false;
} }
@@ -93,11 +95,11 @@ public class ItemChisel extends Item implements IChiselItem {
String lc2 = I18n.format(base + "lc2"); String lc2 = I18n.format(base + "lc2");
String modes = I18n.format(base + "modes"); String modes = I18n.format(base + "modes");
list.add(gui); list.add(gui);
if (type == ChiselType.DIAMOND || type == ChiselType.OBSIDIAN || Configurations.ironChiselCanLeftClick) { if (type == ChiselType.DIAMOND || type == ChiselType.OBSIDIAN || type == ChiselType.NETHERSTAR || Configurations.ironChiselCanLeftClick) {
list.add(lc1); list.add(lc1);
list.add(lc2); list.add(lc2);
} }
if (type == ChiselType.DIAMOND || type == ChiselType.OBSIDIAN || Configurations.ironChiselHasModes) { if (type == ChiselType.DIAMOND || type == ChiselType.OBSIDIAN || type == ChiselType.NETHERSTAR || Configurations.ironChiselHasModes) {
list.add(""); list.add("");
list.add(modes); list.add(modes);
} }
@@ -139,11 +141,11 @@ public class ItemChisel extends Item implements IChiselItem {
@Override @Override
public boolean canChiselBlock(World world, EntityPlayer player, int x, int y, int z, Block block, int metadata) { public boolean canChiselBlock(World world, EntityPlayer player, int x, int y, int z, Block block, int metadata) {
return type == ChiselType.DIAMOND || type == ChiselType.OBSIDIAN || Configurations.ironChiselCanLeftClick; return type == ChiselType.DIAMOND || type == ChiselType.OBSIDIAN || type == ChiselType.NETHERSTAR || Configurations.ironChiselCanLeftClick;
} }
@Override @Override
public boolean hasModes(ItemStack chisel) { public boolean hasModes(ItemStack chisel) {
return type == ChiselType.DIAMOND || type == ChiselType.OBSIDIAN || Configurations.ironChiselHasModes; return type == ChiselType.DIAMOND || type == ChiselType.OBSIDIAN || type == ChiselType.NETHERSTAR || Configurations.ironChiselHasModes;
} }
} }
@@ -5,6 +5,7 @@ import team.chisel.network.message.MessageAutoChisel;
import team.chisel.network.message.MessageChiselMode; import team.chisel.network.message.MessageChiselMode;
import team.chisel.network.message.MessageChiselSound; import team.chisel.network.message.MessageChiselSound;
import team.chisel.network.message.MessagePresentConnect; import team.chisel.network.message.MessagePresentConnect;
import team.chisel.network.message.MessageScrollUpdate;
import team.chisel.network.message.MessageSlotUpdate; import team.chisel.network.message.MessageSlotUpdate;
import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper; import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
@@ -21,5 +22,6 @@ public class PacketHandler {
INSTANCE.registerMessage(MessageAutoChisel.Handler.class, MessageAutoChisel.class, id++, Side.CLIENT); INSTANCE.registerMessage(MessageAutoChisel.Handler.class, MessageAutoChisel.class, id++, Side.CLIENT);
INSTANCE.registerMessage(MessageChiselMode.Handler.class, MessageChiselMode.class, id++, Side.SERVER); INSTANCE.registerMessage(MessageChiselMode.Handler.class, MessageChiselMode.class, id++, Side.SERVER);
INSTANCE.registerMessage(MessagePresentConnect.Handler.class, MessagePresentConnect.class, id++, Side.CLIENT); INSTANCE.registerMessage(MessagePresentConnect.Handler.class, MessagePresentConnect.class, id++, Side.CLIENT);
INSTANCE.registerMessage(MessageScrollUpdate.Handler.class, MessageScrollUpdate.class, id++, Side.SERVER);
} }
} }
@@ -0,0 +1,42 @@
package team.chisel.network.message;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import io.netty.buffer.ByteBuf;
import net.minecraft.inventory.Container;
import team.chisel.inventory.ContainerChisel;
public class MessageScrollUpdate implements IMessage {
private int currentScroll;
public MessageScrollUpdate() {
}
public MessageScrollUpdate(int scroll) {
currentScroll = scroll;
}
@Override
public void fromBytes(ByteBuf buf) {
currentScroll = buf.readInt();
}
@Override
public void toBytes(ByteBuf buf) {
buf.writeInt(currentScroll);
}
public static class Handler implements IMessageHandler<MessageScrollUpdate, IMessage> {
@Override
public IMessage onMessage(MessageScrollUpdate message, MessageContext ctx) {
Container container = ctx.getServerHandler().playerEntity.openContainer;
if (container instanceof ContainerChisel) {
((ContainerChisel) container).inventory.setCurrentScroll(message.currentScroll);
}
return null;
}
}
}
@@ -56,6 +56,14 @@ tile.shingles.5.desc=Schwarze große Vierecke
tile.chisel.valentines.name=Valentinsblock tile.chisel.valentines.name=Valentinsblock
tile.valentines.0.desc=Valentinsziegel tile.valentines.0.desc=Valentinsziegel
tile.valentines.1.desc=Wenn es spricht, würde ich es nicht berühren! tile.valentines.1.desc=Wenn es spricht, würde ich es nicht berühren!
tile.valentines.2.desc=
tile.valentines.3.desc=
tile.valentines.4.desc=
tile.valentines.5.desc=
tile.valentines.6.desc=
tile.valentines.7.desc=
tile.valentines.8.desc=
tile.valentines.9.desc=
# AntiBlocks # AntiBlocks
tile.chisel.antiBlock.name=Antiblock tile.chisel.antiBlock.name=Antiblock
@@ -720,6 +728,7 @@ tile.glass2.0.desc=Asymmetrisches Bleiglas
# Sandstone # Sandstone
tile.chisel.sandstone.name=Sandstein tile.chisel.sandstone.name=Sandstein
tile.chisel.sandstone2.name=Sandstein
tile.sandstone.0.desc=Sandstein mit Glyphen tile.sandstone.0.desc=Sandstein mit Glyphen
tile.sandstone.1.desc=Sandpflaster tile.sandstone.1.desc=Sandpflaster
@@ -738,6 +747,8 @@ tile.sandstone.12.desc=Sandsteinblock
tile.sandstone.13.desc=Schmaler Sandsteinblock tile.sandstone.13.desc=Schmaler Sandsteinblock
tile.sandstone.14.desc=Sandsteinmosaik tile.sandstone.14.desc=Sandsteinmosaik
tile.sandstone.15.desc=Gestapelte Sandsteinfliesen tile.sandstone.15.desc=Gestapelte Sandsteinfliesen
tile.sandstone.16.desc=Sandsteinziegel
tile.sandstone.17.desc=
# Sandstone scribbles # Sandstone scribbles
tile.chisel.sandstone_scribbles.name=Sandstein mit Gekritzel tile.chisel.sandstone_scribbles.name=Sandstein mit Gekritzel
@@ -56,6 +56,14 @@ tile.shingles.5.desc=Black Big Squares
tile.chisel.valentines.name=Valentines Block tile.chisel.valentines.name=Valentines Block
tile.valentines.0.desc=Valentines Bricks tile.valentines.0.desc=Valentines Bricks
tile.valentines.1.desc=If it speaks, I wouldn't touch it tile.valentines.1.desc=If it speaks, I wouldn't touch it
tile.valentines.2.desc=
tile.valentines.3.desc=
tile.valentines.4.desc=
tile.valentines.5.desc=
tile.valentines.6.desc=
tile.valentines.7.desc=
tile.valentines.8.desc=
tile.valentines.9.desc=
# AntiBlocks # AntiBlocks
tile.chisel.antiBlock.name=Anti Block tile.chisel.antiBlock.name=Anti Block
@@ -724,6 +732,7 @@ tile.glass2.0.desc=Asymmetrical Leaded Glass
# Sandstone # Sandstone
tile.chisel.sandstone.name=Sandstone tile.chisel.sandstone.name=Sandstone
tile.chisel.sandstone2.name=Sandstone
tile.sandstone.0.desc=Sandstone Glyphs tile.sandstone.0.desc=Sandstone Glyphs
tile.sandstone.1.desc=Sandcobble tile.sandstone.1.desc=Sandcobble
@@ -742,6 +751,8 @@ tile.sandstone.12.desc=Sandstone Block
tile.sandstone.13.desc=Small Sandstone Blocks tile.sandstone.13.desc=Small Sandstone Blocks
tile.sandstone.14.desc=Sandstone Mosaic tile.sandstone.14.desc=Sandstone Mosaic
tile.sandstone.15.desc=Stacked Sandstone Tiles tile.sandstone.15.desc=Stacked Sandstone Tiles
tile.sandstone.16.desc=Sandstone Bricks
tile.sandstone.17.desc=
# Sandstone scribbles # Sandstone scribbles
tile.chisel.sandstone_scribbles.name=Sandstone Scribbles tile.chisel.sandstone_scribbles.name=Sandstone Scribbles
@@ -57,6 +57,14 @@ tile.shingles.5.desc=Black Big Squares
tile.chisel.valentines.name=Valentines Block tile.chisel.valentines.name=Valentines Block
tile.valentines.0.desc=Valentines Bricks tile.valentines.0.desc=Valentines Bricks
tile.valentines.1.desc=If it speaks, I wouldn't touch it tile.valentines.1.desc=If it speaks, I wouldn't touch it
tile.valentines.2.desc=
tile.valentines.3.desc=
tile.valentines.4.desc=
tile.valentines.5.desc=
tile.valentines.6.desc=
tile.valentines.7.desc=
tile.valentines.8.desc=
tile.valentines.9.desc=
# AntiBlocks # AntiBlocks
tile.chisel.antiBlock.name=Anti Block tile.chisel.antiBlock.name=Anti Block
@@ -722,6 +730,7 @@ tile.glass2.0.desc=Asymmetrical Leaded Glass
# Sandstone # Sandstone
tile.chisel.sandstone.name=Sandstone tile.chisel.sandstone.name=Sandstone
tile.chisel.sandstone2.name=Sandstone
tile.sandstone.0.desc=Sandstone Glyphs tile.sandstone.0.desc=Sandstone Glyphs
tile.sandstone.1.desc=Sandcobble tile.sandstone.1.desc=Sandcobble
@@ -740,6 +749,8 @@ tile.sandstone.12.desc=Sandstone Block
tile.sandstone.13.desc=Small Sandstone Blocks tile.sandstone.13.desc=Small Sandstone Blocks
tile.sandstone.14.desc=Sandstone Mosaic tile.sandstone.14.desc=Sandstone Mosaic
tile.sandstone.15.desc=Stacked Sandstone Tiles tile.sandstone.15.desc=Stacked Sandstone Tiles
tile.sandstone.16.desc=Sandstone Bricks
tile.sandstone.17.desc=
# Sandstone scribbles # Sandstone scribbles
tile.chisel.sandstone_scribbles.name=Sandstone Scribbles tile.chisel.sandstone_scribbles.name=Sandstone Scribbles
@@ -16,6 +16,7 @@ item.chisel.chisel.desc.modes=Has multiple modes for chiseling.
item.chisel.chisel_diamond.name=Diamond Chisel item.chisel.chisel_diamond.name=Diamond Chisel
item.chisel.chisel_obsidian.name=Obsidian Chisel item.chisel.chisel_obsidian.name=Obsidian Chisel
item.chisel.chisel_netherstar.name=Nether Star Chisel
item.ballMoss.name=Ball O' Moss item.ballMoss.name=Ball O' Moss
item.ballMoss.desc=Right-Click to throw. This will turn Cobblestone to Moss Stone on impact. item.ballMoss.desc=Right-Click to throw. This will turn Cobblestone to Moss Stone on impact.
@@ -59,6 +60,14 @@ tile.shingles.5.desc=Black Big Squares
tile.chisel.valentines.name=Valentines Block tile.chisel.valentines.name=Valentines Block
tile.valentines.0.desc=Valentines Bricks tile.valentines.0.desc=Valentines Bricks
tile.valentines.1.desc=If it speaks, I wouldn't touch it tile.valentines.1.desc=If it speaks, I wouldn't touch it
tile.valentines.2.desc=
tile.valentines.3.desc=
tile.valentines.4.desc=
tile.valentines.5.desc=
tile.valentines.6.desc=
tile.valentines.7.desc=
tile.valentines.8.desc=
tile.valentines.9.desc=
#AntiBlocks #AntiBlocks
tile.chisel.antiBlock.name=Anti Block tile.chisel.antiBlock.name=Anti Block
@@ -724,6 +733,7 @@ tile.glass2.0.desc=Asymmetrical Leaded Glass
#Sandstone #Sandstone
tile.chisel.sandstone.name=Sandstone tile.chisel.sandstone.name=Sandstone
tile.chisel.sandstone2.name=Sandstone
tile.sandstone.0.desc=Sandstone Glyphs tile.sandstone.0.desc=Sandstone Glyphs
tile.sandstone.1.desc=Sandcobble tile.sandstone.1.desc=Sandcobble
@@ -742,6 +752,8 @@ tile.sandstone.12.desc=Sandstone Block
tile.sandstone.13.desc=Small Sandstone Blocks tile.sandstone.13.desc=Small Sandstone Blocks
tile.sandstone.14.desc=Sandstone Mosaic tile.sandstone.14.desc=Sandstone Mosaic
tile.sandstone.15.desc=Stacked Sandstone Tiles tile.sandstone.15.desc=Stacked Sandstone Tiles
tile.sandstone.16.desc=Sandstone Bricks
tile.sandstone.17.desc=
#Sandstone scribbles #Sandstone scribbles
tile.chisel.sandstone_scribbles.name=Sandstone Scribbles tile.chisel.sandstone_scribbles.name=Sandstone Scribbles
File diff suppressed because it is too large. Load diff
Binary file not shown.

After

Width:  |  Height:  |  Size: 228 B