-
Notifications
You must be signed in to change notification settings - Fork 71
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
1 parent
86a6583
commit bc011de
Showing
4 changed files
with
195 additions
and
0 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
src/main/java/com/laytonsmith/abstraction/blocks/MCDecoratedPot.java
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,17 @@ | ||
package com.laytonsmith.abstraction.blocks; | ||
|
||
import java.util.Map; | ||
|
||
public interface MCDecoratedPot extends MCBlockState { | ||
|
||
Map<Side, MCMaterial> getSherds(); | ||
|
||
void setSherd(Side side, MCMaterial sherd); | ||
|
||
enum Side { | ||
BACK, | ||
FRONT, | ||
LEFT, | ||
RIGHT | ||
} | ||
} |
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
39 changes: 39 additions & 0 deletions
39
src/main/java/com/laytonsmith/abstraction/bukkit/blocks/BukkitMCDecoratedPot.java
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,39 @@ | ||
package com.laytonsmith.abstraction.bukkit.blocks; | ||
|
||
import com.laytonsmith.abstraction.blocks.MCDecoratedPot; | ||
import com.laytonsmith.abstraction.blocks.MCMaterial; | ||
import org.bukkit.Material; | ||
import org.bukkit.block.DecoratedPot; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
public class BukkitMCDecoratedPot extends BukkitMCBlockState implements MCDecoratedPot { | ||
|
||
DecoratedPot dp; | ||
|
||
public BukkitMCDecoratedPot(DecoratedPot pot) { | ||
super(pot); | ||
this.dp = pot; | ||
} | ||
|
||
@Override | ||
public DecoratedPot getHandle() { | ||
return this.dp; | ||
} | ||
|
||
@Override | ||
public Map<MCDecoratedPot.Side, MCMaterial> getSherds() { | ||
Map<MCDecoratedPot.Side, MCMaterial> sherds = new HashMap<>(); | ||
for(Map.Entry<DecoratedPot.Side, Material> sherd : this.dp.getSherds().entrySet()) { | ||
sherds.put(MCDecoratedPot.Side.valueOf(sherd.getKey().name()), BukkitMCMaterial.valueOfConcrete(sherd.getValue())); | ||
} | ||
return sherds; | ||
} | ||
|
||
@Override | ||
public void setSherd(MCDecoratedPot.Side side, MCMaterial sherd) { | ||
DecoratedPot.Side concreteSide = DecoratedPot.Side.valueOf(side.name()); | ||
this.dp.setSherd(concreteSide, (Material) sherd.getHandle()); | ||
} | ||
} |
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