-
Notifications
You must be signed in to change notification settings - Fork 2
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
0eed26f
commit 43773ac
Showing
11 changed files
with
151 additions
and
79 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
27 changes: 10 additions & 17 deletions
27
src/main/java/cn/wode490390/nukkit/scatteredbuilding/loot/JungleTempleDispenser.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 |
---|---|---|
@@ -1,29 +1,22 @@ | ||
package cn.wode490390.nukkit.scatteredbuilding.loot; | ||
|
||
import cn.nukkit.inventory.Inventory; | ||
import cn.nukkit.inventory.InventoryType; | ||
import cn.nukkit.item.Item; | ||
import cn.nukkit.math.NukkitRandom; | ||
import java.util.Collections; | ||
import java.util.List; | ||
import java.util.Map; | ||
import com.google.common.collect.Maps; | ||
|
||
public class JungleTempleDispenser extends RandomizableContainer { | ||
|
||
private JungleTempleDispenser() { | ||
private static final JungleTempleDispenser INSTANCE = new JungleTempleDispenser(); | ||
|
||
public static JungleTempleDispenser get() { | ||
return INSTANCE; | ||
} | ||
|
||
@Override | ||
public void create(Inventory inventory, NukkitRandom random) { | ||
for (int i = 0; i < 2; i++) { | ||
inventory.setItem(random.nextBoundedInt(inventory.getSize()), Item.get(Item.ARROW, 0, random.nextRange(2, 7)), false); | ||
} | ||
} | ||
private JungleTempleDispenser() { | ||
super(Maps.newHashMap(), 9); //InventoryType.DISPENSER.getDefaultSize() | ||
|
||
@Override | ||
public Map<List<ItemEntry>, RollEntry> getPools() { | ||
return Collections.emptyMap(); | ||
PoolBuilder pool1 = new PoolBuilder() | ||
.register(new ItemEntry(Item.ARROW, 0, 7, 2, 1)); | ||
this.pools.put(pool1.build(), new RollEntry(2, 0)); | ||
} | ||
|
||
public static final JungleTempleDispenser INSTANCE = new JungleTempleDispenser(); | ||
} |
35 changes: 28 additions & 7 deletions
35
src/main/java/cn/wode490390/nukkit/scatteredbuilding/loot/RandomizableContainer.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
26 changes: 26 additions & 0 deletions
26
src/main/java/cn/wode490390/nukkit/scatteredbuilding/scheduler/TileSyncTask.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,26 @@ | ||
package cn.wode490390.nukkit.scatteredbuilding.scheduler; | ||
|
||
import cn.nukkit.blockentity.BlockEntity; | ||
import cn.nukkit.level.format.FullChunk; | ||
import cn.nukkit.nbt.tag.CompoundTag; | ||
import cn.nukkit.scheduler.PluginTask; | ||
import cn.wode490390.nukkit.scatteredbuilding.ScatteredBuildingPopulator; | ||
|
||
public class TileSyncTask extends PluginTask<ScatteredBuildingPopulator> { | ||
|
||
public final String type; | ||
public final FullChunk chunk; | ||
public final CompoundTag nbt; | ||
|
||
public TileSyncTask(String type, FullChunk chunk, CompoundTag nbt) { | ||
super(ScatteredBuildingPopulator.getInstance()); | ||
this.type = type; | ||
this.chunk = chunk; | ||
this.nbt = nbt; | ||
} | ||
|
||
@Override | ||
public void onRun(int currentTick) { | ||
BlockEntity.createBlockEntity(this.type, this.chunk, this.nbt); | ||
} | ||
} |
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
Oops, something went wrong.