-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
144 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package common.block; | ||
|
||
import client.Game; | ||
import client.renderables.EntityRenderer; | ||
import common.item.ItemBlock; | ||
import common.registries.Blocks; | ||
import common.registries.Items; | ||
import common.world.World; | ||
|
||
public class BlockCrafter extends Block { | ||
public BlockCrafter(String name) { | ||
super(name); | ||
} | ||
|
||
@Override | ||
public void onBlockRightClick(World world, EntityRenderer entity) { | ||
super.onBlockRightClick(world, entity); | ||
if (Blocks.stone.getName().equals(Game.headsUpDisplay.getSelected().getItemStack().getItem().getName())){ | ||
for (int i = 0; i < Game.headsUpDisplay.getSlots().length; i++) { | ||
if (Game.headsUpDisplay.getSlots()[i].getItemStack().getItem() instanceof ItemBlock) { | ||
if (((ItemBlock) Game.headsUpDisplay.getSlots()[i].getItemStack().getItem()).getBlock() == Blocks.wood_producer) { | ||
Game.headsUpDisplay.getSlots()[i].getItemStack().setAmount(Game.headsUpDisplay.getSlots()[i].getItemStack().getAmount() + 1); | ||
Game.headsUpDisplay.getSelected().getItemStack().setAmount(Game.headsUpDisplay.getSelected().getItemStack().getAmount()-1); | ||
break; | ||
} else if (((ItemBlock) Game.headsUpDisplay.getSlots()[i].getItemStack().getItem()).getBlock().isAir()){ | ||
Game.headsUpDisplay.getSlots()[i].getItemStack().setItem(Items.getItem(Blocks.wood_producer.getName())); | ||
Game.headsUpDisplay.getSlots()[i].getItemStack().setAmount(1); | ||
Game.headsUpDisplay.getSelected().getItemStack().setAmount(Game.headsUpDisplay.getSelected().getItemStack().getAmount()-1); | ||
break; | ||
} | ||
} | ||
} | ||
} else if (Blocks.log.getName().equals(Game.headsUpDisplay.getSelected().getItemStack().getItem().getName())){ | ||
for (int i = 0; i < Game.headsUpDisplay.getSlots().length; i++) { | ||
if (Game.headsUpDisplay.getSlots()[i].getItemStack().getItem() instanceof ItemBlock) { | ||
if (((ItemBlock) Game.headsUpDisplay.getSlots()[i].getItemStack().getItem()).getBlock() == Blocks.planks) { | ||
Game.headsUpDisplay.getSlots()[i].getItemStack().setAmount(Game.headsUpDisplay.getSlots()[i].getItemStack().getAmount() + 4); | ||
Game.headsUpDisplay.getSelected().getItemStack().setAmount(Game.headsUpDisplay.getSelected().getItemStack().getAmount()-1); | ||
break; | ||
} else if (((ItemBlock) Game.headsUpDisplay.getSlots()[i].getItemStack().getItem()).getBlock().isAir()){ | ||
Game.headsUpDisplay.getSlots()[i].getItemStack().setItem(Items.getItem(Blocks.planks.getName())); | ||
Game.headsUpDisplay.getSlots()[i].getItemStack().setAmount(4); | ||
Game.headsUpDisplay.getSelected().getItemStack().setAmount(Game.headsUpDisplay.getSelected().getItemStack().getAmount()-1); | ||
break; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
@Override | ||
public void onTick(World world, int x, int y) { | ||
super.onTick(world, x, y); | ||
} | ||
|
||
@Override | ||
public boolean isSolid() { | ||
return super.isSolid(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package common.block; | ||
|
||
import client.Game; | ||
import client.renderables.EntityRenderer; | ||
import common.item.ItemBlock; | ||
import common.registries.Blocks; | ||
import common.registries.Items; | ||
import common.world.World; | ||
|
||
public class BlockWoodProducer extends Block { | ||
public BlockWoodProducer(String name) { | ||
super(name); | ||
} | ||
|
||
@Override | ||
public void onBlockRightClick(World world, EntityRenderer entity) { | ||
super.onBlockRightClick(world, entity); | ||
if (Blocks.sapling.getName().equals(Game.headsUpDisplay.getSelected().getItemStack().getItem().getName())&& Game.headsUpDisplay.getSelected().getItemStack().getAmount() >= 1){ | ||
for (int i = 0; i < Game.headsUpDisplay.getSlots().length; i++) { | ||
if (Game.headsUpDisplay.getSlots()[i].getItemStack().getItem() instanceof ItemBlock) { | ||
if (((ItemBlock) Game.headsUpDisplay.getSlots()[i].getItemStack().getItem()).getBlock() == Blocks.log) { | ||
Game.headsUpDisplay.getSlots()[i].getItemStack().setAmount(Game.headsUpDisplay.getSlots()[i].getItemStack().getAmount() + 4); | ||
Game.headsUpDisplay.getSelected().getItemStack().setAmount(Game.headsUpDisplay.getSelected().getItemStack().getAmount()-1); | ||
break; | ||
} else if (((ItemBlock) Game.headsUpDisplay.getSlots()[i].getItemStack().getItem()).getBlock().isAir()){ | ||
Game.headsUpDisplay.getSlots()[i].getItemStack().setItem(Items.getItem(Blocks.log.getName())); | ||
Game.headsUpDisplay.getSlots()[i].getItemStack().setAmount(4); | ||
Game.headsUpDisplay.getSelected().getItemStack().setAmount(Game.headsUpDisplay.getSelected().getItemStack().getAmount()-1); | ||
break; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
@Override | ||
public void onTick(World world, int x, int y) { | ||
super.onTick(world, x, y); | ||
} | ||
|
||
@Override | ||
public boolean isSolid() { | ||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.