Finished XP Solidifier

This commit is contained in:
Ellpeck 2015-07-15 01:53:04 +02:00
parent dd7b9dbc6d
commit 9f20575875
4 changed files with 16 additions and 11 deletions

View file

@ -5,11 +5,12 @@ Actually Additions adds an InterModCommunications Feature that allows you to add
To use these Features, just send an InterModComms Message in your preInit or init like this:
FMLInterModComms.sendMessage("ActuallyAdditions", [X], [Y]);
This Message has to be sent BEFORE FMLPostInitializationEvent!
The two Brackets will have to get replaced with one of the parts of Information below.
##### Crusher Recipes
- Create an NBTTagCompound
- To the Compound, add an NBTTagCompound with the name "input" that contains the Input ItemStack saved to NBT (To do this, just use ItemStack.saveToNBT)
- To the Compound, add an NBTTagCompound with the name "input" that contains the Input ItemStack saved to NBT (To do this, just use ItemStack.writeToNBT)
- To the Compound, add an NBTTagCompound with the name "outputOne" that contains the first Output saved to NBT
- To the Compound, add an NBTTagCompound with the name "outputTwo" that contains the second Output saved to NBT
- To the Compound, add an int with the name "secondChance" that contains the Chance for the second Output to appear
@ -17,7 +18,7 @@ The two Brackets will have to get replaced with one of the parts of Information
##### Coffee Machine Recipes
- Create an NBTTagCompound
- To the Compound, add an NBTTagCompound with the name "input" that contains the Input ItemStack saved to NBT (To do this, just use ItemStack.saveToNBT)
- To the Compound, add an NBTTagCompound with the name "input" that contains the Input ItemStack saved to NBT (To do this, just use ItemStack.writeToNBT)
- To the Compound, add an int with the name "id" that contains the ID of the Effect the Coffee should have (Look up the Effects in Minecraft's Potion Class!)
- To the Compound, add an int with the name "duration" that contains the Duration the Effect should have
- To the Compound, add an int with the name "amplifier" that contains the Amplifier the Effect should have (Remember: 0 = Level 1!)
@ -26,13 +27,13 @@ The two Brackets will have to get replaced with one of the parts of Information
##### Ball of Hair Recipes
- Create an NBTTagCompound
- To the Compound, add an NBTTagCompound with the name "output" that contains the Input ItemStack saved to NBT (To do this, just use ItemStack.saveToNBT)
- To the Compound, add an NBTTagCompound with the name "output" that contains the Input ItemStack saved to NBT (To do this, just use ItemStack.writeToNBT)
- To the Compound, add an int with the name "chance" that contains the Chance of the Item appearing
- Send the Message with "registerBallOfHairRecipe" as the [X] Argument, the Compound as the [Y] Argument.
##### Treasure Chest Recipes
- Create an NBTTagCompound
- To the Compound, add an NBTTagCompound with the name "output" that contains the Input ItemStack saved to NBT (To do this, just use ItemStack.saveToNBT)
- To the Compound, add an NBTTagCompound with the name "output" that contains the Input ItemStack saved to NBT (To do this, just use ItemStack.writeToNBT)
- To the Compound, add an int with the name "chance" that contains the Chance of the Item appearing
- To the Compound, add an int with the name "minAmount" that contains the minimum size of the ItemStack
- To the Compound, add an int with the name "maxAmount" that contains the maximum size of the ItemStack

View file

@ -80,13 +80,13 @@ public class InitBlocks{
public static Block blockTreasureChest;
//public static Block blockXPSolidifier;
public static Block blockXPSolidifier;
public static void init(){
ModUtil.LOGGER.info("Initializing Blocks...");
//blockXPSolidifier = new BlockXPSolidifier();
//BlockUtil.register(blockXPSolidifier, BlockXPSolidifier.TheItemBlock.class);
blockXPSolidifier = new BlockXPSolidifier();
BlockUtil.register(blockXPSolidifier, BlockXPSolidifier.TheItemBlock.class);
blockTestifiBucksGreenWall = new BlockGeneric("blockTestifiBucksGreenWall");
BlockUtil.register(blockTestifiBucksGreenWall, BlockGeneric.TheItemBlock.class);

View file

@ -53,7 +53,7 @@ public class GuiXPSolidifier extends GuiContainer{
GuiButton buttonForty = new GuiInputter.SmallerButton(5, guiLeft+99, guiTop+61, "40");
GuiButton buttonFifty = new GuiInputter.SmallerButton(6, guiLeft+62, guiTop+78, "50");
GuiButton buttonSixtyFour = new GuiInputter.SmallerButton(7, guiLeft+80, guiTop+78, "64");
GuiButton buttonThousandTwentyEight = new GuiInputter.SmallerButton(8, guiLeft+99, guiTop+78, "All");
GuiButton buttonAll = new GuiInputter.SmallerButton(8, guiLeft+99, guiTop+78, "All");
this.buttonList.add(buttonOne);
this.buttonList.add(buttonFive);
@ -63,7 +63,7 @@ public class GuiXPSolidifier extends GuiContainer{
this.buttonList.add(buttonForty);
this.buttonList.add(buttonFifty);
this.buttonList.add(buttonSixtyFour);
this.buttonList.add(buttonThousandTwentyEight);
this.buttonList.add(buttonAll);
}
@Override

View file

@ -76,14 +76,18 @@ public class TileEntityXPSolidifier extends TileEntityInventoryBase implements I
@Override
public void onButtonPressed(int buttonID, EntityPlayer player){
if(buttonID < this.buttonAmounts.length){
if(buttonAmounts[buttonID] != -999){
if(this.buttonAmounts[buttonID] != -999){
if(this.amount < Short.MAX_VALUE-this.buttonAmounts[buttonID] && this.getPlayerXP(player) >= ItemSpecialDrop.SOLID_XP_AMOUNT*this.buttonAmounts[buttonID]){
this.addPlayerXP(player, -(ItemSpecialDrop.SOLID_XP_AMOUNT*this.buttonAmounts[buttonID]));
this.amount += this.buttonAmounts[buttonID];
}
}
else{
int xp = this.getPlayerXP(player)/ItemSpecialDrop.SOLID_XP_AMOUNT;
if(this.amount < Short.MAX_VALUE-xp){
this.addPlayerXP(player, -(xp*ItemSpecialDrop.SOLID_XP_AMOUNT));
this.amount += xp;
}
}
}
}