Skip to content

Commit 49117c0

Browse files
committed
update block states
1 parent 955ba6c commit 49117c0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+347
-324
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package org.bukkit.block;
2+
3+
/**
4+
* Represents a captured state of a test block.
5+
*/
6+
public interface TestBlock extends TileState {
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package org.bukkit.block;
2+
3+
/**
4+
* Represents a captured state of a test block.
5+
*/
6+
public interface TestInstanceBlock extends TileState {
7+
}

paper-api/src/main/java/org/bukkit/block/data/type/LeafLitter.java

+1-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,4 @@
33
import org.bukkit.block.data.Directional;
44
import org.bukkit.block.data.Segmentable;
55

6-
/**
7-
* 'segment_amount' represents the number of leaves.
8-
*/
9-
public interface LeafLitter extends Segmentable, Directional {}
6+
public interface LeafLitter extends Segmentable, Directional { }

paper-server/src/main/java/org/bukkit/craftbukkit/block/CraftBanner.java

+11-11
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ public class CraftBanner extends CraftBlockEntityState<BannerBlockEntity> implem
1919
private DyeColor base;
2020
private List<Pattern> patterns;
2121

22-
public CraftBanner(World world, BannerBlockEntity tileEntity) {
23-
super(world, tileEntity);
22+
public CraftBanner(World world, BannerBlockEntity blockEntity) {
23+
super(world, blockEntity);
2424
}
2525

2626
protected CraftBanner(CraftBanner state, Location location) {
@@ -30,15 +30,15 @@ protected CraftBanner(CraftBanner state, Location location) {
3030
}
3131

3232
@Override
33-
public void load(BannerBlockEntity banner) {
34-
super.load(banner);
33+
public void load(BannerBlockEntity blockEntity) {
34+
super.load(blockEntity);
3535

3636
this.base = DyeColor.getByWoolData((byte) ((AbstractBannerBlock) this.data.getBlock()).getColor().getId());
3737
this.patterns = new ArrayList<Pattern>();
3838

39-
if (banner.getPatterns() != null) {
40-
for (int i = 0; i < banner.getPatterns().layers().size(); i++) {
41-
BannerPatternLayers.Layer p = banner.getPatterns().layers().get(i);
39+
if (blockEntity.getPatterns() != null) {
40+
for (int i = 0; i < blockEntity.getPatterns().layers().size(); i++) {
41+
BannerPatternLayers.Layer p = blockEntity.getPatterns().layers().get(i);
4242
// Paper start - fix upstream not handling inlined banner pattern
4343
java.util.Optional<org.bukkit.block.banner.PatternType> type = org.bukkit.craftbukkit.CraftRegistry.unwrapAndConvertHolder(RegistryKey.BANNER_PATTERN, p.pattern());
4444
if (type.isEmpty()) continue;
@@ -95,17 +95,17 @@ public int numberOfPatterns() {
9595
}
9696

9797
@Override
98-
public void applyTo(BannerBlockEntity banner) {
99-
super.applyTo(banner);
98+
public void applyTo(BannerBlockEntity blockEntity) {
99+
super.applyTo(blockEntity);
100100

101-
banner.baseColor = net.minecraft.world.item.DyeColor.byId(this.base.getWoolData());
101+
blockEntity.baseColor = net.minecraft.world.item.DyeColor.byId(this.base.getWoolData());
102102

103103
List<BannerPatternLayers.Layer> newPatterns = new ArrayList<>();
104104

105105
for (Pattern p : this.patterns) {
106106
newPatterns.add(new net.minecraft.world.level.block.entity.BannerPatternLayers.Layer(CraftPatternType.bukkitToMinecraftHolder(p.getPattern()), net.minecraft.world.item.DyeColor.byId(p.getColor().getWoolData())));
107107
}
108-
banner.setPatterns(new BannerPatternLayers(newPatterns));
108+
blockEntity.setPatterns(new BannerPatternLayers(newPatterns));
109109
}
110110

111111
@Override

paper-server/src/main/java/org/bukkit/craftbukkit/block/CraftBarrel.java

+14-14
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212

1313
public class CraftBarrel extends CraftLootable<BarrelBlockEntity> implements Barrel {
1414

15-
public CraftBarrel(World world, BarrelBlockEntity tileEntity) {
16-
super(world, tileEntity);
15+
public CraftBarrel(World world, BarrelBlockEntity blockEntity) {
16+
super(world, blockEntity);
1717
}
1818

1919
protected CraftBarrel(CraftBarrel state, Location location) {
@@ -31,37 +31,37 @@ public Inventory getInventory() {
3131
return this.getSnapshotInventory();
3232
}
3333

34-
return new CraftInventory(this.getTileEntity());
34+
return new CraftInventory(this.getBlockEntity());
3535
}
3636

3737
@Override
3838
public void open() {
3939
this.requirePlaced();
40-
if (!this.getTileEntity().openersCounter.opened) {
41-
BlockState blockData = this.getTileEntity().getBlockState();
40+
if (!this.getBlockEntity().openersCounter.opened) {
41+
BlockState blockData = this.getBlockEntity().getBlockState();
4242
boolean open = blockData.getValue(BarrelBlock.OPEN);
4343

4444
if (!open) {
45-
this.getTileEntity().updateBlockState(blockData, true);
45+
this.getBlockEntity().updateBlockState(blockData, true);
4646
if (this.getWorldHandle() instanceof net.minecraft.world.level.Level) {
47-
this.getTileEntity().playSound(blockData, SoundEvents.BARREL_OPEN);
47+
this.getBlockEntity().playSound(blockData, SoundEvents.BARREL_OPEN);
4848
}
4949
}
5050
}
51-
this.getTileEntity().openersCounter.opened = true;
51+
this.getBlockEntity().openersCounter.opened = true;
5252
}
5353

5454
@Override
5555
public void close() {
5656
this.requirePlaced();
57-
if (this.getTileEntity().openersCounter.opened) {
58-
BlockState blockData = this.getTileEntity().getBlockState();
59-
this.getTileEntity().updateBlockState(blockData, false);
57+
if (this.getBlockEntity().openersCounter.opened) {
58+
BlockState blockData = this.getBlockEntity().getBlockState();
59+
this.getBlockEntity().updateBlockState(blockData, false);
6060
if (this.getWorldHandle() instanceof net.minecraft.world.level.Level) {
61-
this.getTileEntity().playSound(blockData, SoundEvents.BARREL_CLOSE);
61+
this.getBlockEntity().playSound(blockData, SoundEvents.BARREL_CLOSE);
6262
}
6363
}
64-
this.getTileEntity().openersCounter.opened = false;
64+
this.getBlockEntity().openersCounter.opened = false;
6565
}
6666

6767
@Override
@@ -77,7 +77,7 @@ public CraftBarrel copy(Location location) {
7777
// Paper start - More Lidded Block API
7878
@Override
7979
public boolean isOpen() {
80-
return getTileEntity().openersCounter.opened;
80+
return getBlockEntity().openersCounter.opened;
8181
}
8282
// Paper end - More Lidded Block API
8383
}

paper-server/src/main/java/org/bukkit/craftbukkit/block/CraftBeacon.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727

2828
public class CraftBeacon extends CraftBlockEntityState<BeaconBlockEntity> implements Beacon {
2929

30-
public CraftBeacon(World world, BeaconBlockEntity tileEntity) {
31-
super(world, tileEntity);
30+
public CraftBeacon(World world, BeaconBlockEntity blockEntity) {
31+
super(world, blockEntity);
3232
}
3333

3434
protected CraftBeacon(CraftBeacon state, Location location) {
@@ -39,9 +39,9 @@ protected CraftBeacon(CraftBeacon state, Location location) {
3939
public Collection<LivingEntity> getEntitiesInRange() {
4040
this.ensureNoWorldGeneration();
4141

42-
BlockEntity tileEntity = this.getTileEntityFromWorld();
43-
if (tileEntity instanceof BeaconBlockEntity) {
44-
BeaconBlockEntity beacon = (BeaconBlockEntity) tileEntity;
42+
BlockEntity blockEntity = this.getBlockEntityFromWorld();
43+
if (blockEntity instanceof BeaconBlockEntity) {
44+
BeaconBlockEntity beacon = (BeaconBlockEntity) blockEntity;
4545

4646
Collection<Player> nms = BeaconBlockEntity.getHumansInRange(beacon.getLevel(), beacon.getBlockPos(), beacon.levels, beacon); // Paper - Custom beacon ranges
4747
Collection<LivingEntity> bukkit = new ArrayList<LivingEntity>(nms.size());

paper-server/src/main/java/org/bukkit/craftbukkit/block/CraftBed.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88

99
public class CraftBed extends CraftBlockEntityState<BedBlockEntity> implements Bed {
1010

11-
public CraftBed(World world, BedBlockEntity tileEntity) {
12-
super(world, tileEntity);
11+
public CraftBed(World world, BedBlockEntity blockEntity) {
12+
super(world, blockEntity);
1313
}
1414

1515
protected CraftBed(CraftBed state, Location location) {

paper-server/src/main/java/org/bukkit/craftbukkit/block/CraftBeehive.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616

1717
public class CraftBeehive extends CraftBlockEntityState<BeehiveBlockEntity> implements Beehive {
1818

19-
public CraftBeehive(World world, BeehiveBlockEntity tileEntity) {
20-
super(world, tileEntity);
19+
public CraftBeehive(World world, BeehiveBlockEntity blockEntity) {
20+
super(world, blockEntity);
2121
}
2222

2323
protected CraftBeehive(CraftBeehive state, Location location) {
@@ -43,7 +43,7 @@ public boolean isFull() {
4343

4444
@Override
4545
public boolean isSedated() {
46-
return this.isPlaced() && this.getTileEntity().isSedated();
46+
return this.isPlaced() && this.getBlockEntity().isSedated();
4747
}
4848

4949
@Override
@@ -70,7 +70,7 @@ public List<Bee> releaseEntities() {
7070
List<Bee> bees = new ArrayList<>();
7171

7272
if (this.isPlaced()) {
73-
BeehiveBlockEntity beehive = ((BeehiveBlockEntity) this.getTileEntityFromWorld());
73+
BeehiveBlockEntity beehive = ((BeehiveBlockEntity) this.getBlockEntityFromWorld());
7474
for (Entity bee : beehive.releaseBees(this.getHandle(), BeeReleaseStatus.BEE_RELEASED, true)) {
7575
bees.add((Bee) bee.getBukkitEntity());
7676
}

paper-server/src/main/java/org/bukkit/craftbukkit/block/CraftBell.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515

1616
public class CraftBell extends CraftBlockEntityState<BellBlockEntity> implements Bell {
1717

18-
public CraftBell(World world, BellBlockEntity tileEntity) {
19-
super(world, tileEntity);
18+
public CraftBell(World world, BellBlockEntity blockEntity) {
19+
super(world, blockEntity);
2020
}
2121

2222
protected CraftBell(CraftBell state, Location location) {
@@ -27,8 +27,8 @@ protected CraftBell(CraftBell state, Location location) {
2727
public boolean ring(Entity entity, BlockFace direction) {
2828
Preconditions.checkArgument(direction == null || direction.isCartesian(), "direction must be cartesian, given %s", direction);
2929

30-
BlockEntity tileEntity = this.getTileEntityFromWorld();
31-
if (tileEntity == null) {
30+
BlockEntity blockEntity = this.getBlockEntityFromWorld();
31+
if (blockEntity == null) {
3232
return false;
3333
}
3434

paper-server/src/main/java/org/bukkit/craftbukkit/block/CraftBlastFurnace.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77

88
public class CraftBlastFurnace extends CraftFurnace<BlastFurnaceBlockEntity> implements BlastFurnace {
99

10-
public CraftBlastFurnace(World world, BlastFurnaceBlockEntity tileEntity) {
11-
super(world, tileEntity);
10+
public CraftBlastFurnace(World world, BlastFurnaceBlockEntity blockEntity) {
11+
super(world, blockEntity);
1212
}
1313

1414
protected CraftBlastFurnace(CraftBlastFurnace state, Location location) {

0 commit comments

Comments
 (0)