Skip to content

Commit 4bfe68d

Browse files
committed
Swap to official mappings, per Forge upstream
1 parent 78ec7a9 commit 4bfe68d

Some content is hidden

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

43 files changed

+376
-353
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ sourceSets {
3535

3636
println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch'))
3737
minecraft {
38-
mappings channel: 'snapshot', version: mappings_version
38+
mappings channel: 'official', version: mappings_version
3939
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
4040

4141
// accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ org.gradle.daemon=false
55

66
minecraft_version=1.16.5
77
forge_version=36.0.46
8-
mappings_version=20201028-1.16.3
8+
mappings_version=1.16.5
99

1010
mod_id=compactmachines
1111
mod_version=4.0.0-beta.2

src/main/java/com/robotgryphon/compactmachines/CompactMachines.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public class CompactMachines
3232

3333
public static ItemGroup COMPACT_MACHINES_ITEMS = new ItemGroup(MOD_ID) {
3434
@Override
35-
public ItemStack createIcon() {
35+
public ItemStack makeIcon() {
3636
return new ItemStack(Registration.MACHINE_BLOCK_ITEM_NORMAL.get());
3737
}
3838
};

src/main/java/com/robotgryphon/compactmachines/block/BlockCompactMachine.java

Lines changed: 34 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -43,19 +43,21 @@
4343
import java.util.Set;
4444
import java.util.UUID;
4545

46+
import net.minecraft.block.AbstractBlock;
47+
4648
public class BlockCompactMachine extends Block implements IProbeDataProvider {
4749

4850
private final EnumMachineSize size;
4951

50-
public BlockCompactMachine(EnumMachineSize size, Block.Properties props) {
52+
public BlockCompactMachine(EnumMachineSize size, AbstractBlock.Properties props) {
5153
super(props);
5254
this.size = size;
5355
}
5456

5557
@Override
56-
public float getPlayerRelativeBlockHardness(BlockState state, PlayerEntity player, IBlockReader worldIn, BlockPos pos) {
57-
CompactMachineTile tile = (CompactMachineTile) worldIn.getTileEntity(pos);
58-
float normalHardness = super.getPlayerRelativeBlockHardness(state, player, worldIn, pos);
58+
public float getDestroyProgress(BlockState state, PlayerEntity player, IBlockReader worldIn, BlockPos pos) {
59+
CompactMachineTile tile = (CompactMachineTile) worldIn.getBlockEntity(pos);
60+
float normalHardness = super.getDestroyProgress(state, player, worldIn, pos);
5961

6062
if (tile == null)
6163
return normalHardness;
@@ -73,7 +75,7 @@ public float getPlayerRelativeBlockHardness(BlockState state, PlayerEntity playe
7375
case OWNER:
7476
Optional<UUID> ownerUUID = tile.getOwnerUUID();
7577
return ownerUUID
76-
.map(uuid -> player.getUniqueID() == uuid ? normalHardness : 0)
78+
.map(uuid -> player.getUUID() == uuid ? normalHardness : 0)
7779
.orElse(normalHardness);
7880

7981
case ANYONE:
@@ -91,7 +93,7 @@ public boolean canConnectRedstone(BlockState state, IBlockReader world, BlockPos
9193
}
9294

9395
@Override
94-
public int getWeakPower(BlockState blockState, IBlockReader blockAccess, BlockPos pos, Direction side) {
96+
public int getSignal(BlockState blockState, IBlockReader blockAccess, BlockPos pos, Direction side) {
9597
// TODO Tile Entity
9698
// if(!(blockAccess.getTileEntity(pos) instanceof TileEntityMachine)) {
9799
// return 0;
@@ -110,34 +112,34 @@ public int getWeakPower(BlockState blockState, IBlockReader blockAccess, BlockPo
110112
public void neighborChanged(BlockState state, World world, BlockPos pos, Block changedBlock, BlockPos changedPos, boolean isMoving) {
111113
super.neighborChanged(state, world, pos, changedBlock, changedPos, isMoving);
112114

113-
if (world.isRemote)
115+
if (world.isClientSide)
114116
return;
115117

116118
ServerWorld serverWorld = (ServerWorld) world;
117119

118120
BlockState changedState = serverWorld.getBlockState(changedPos);
119121

120-
CompactMachineTile machine = (CompactMachineTile) serverWorld.getTileEntity(pos);
122+
CompactMachineTile machine = (CompactMachineTile) serverWorld.getBlockEntity(pos);
121123
if (machine == null)
122124
return;
123125

124-
ServerWorld compactWorld = serverWorld.getServer().getWorld(Registration.COMPACT_DIMENSION);
126+
ServerWorld compactWorld = serverWorld.getServer().getLevel(Registration.COMPACT_DIMENSION);
125127
if (compactWorld == null) {
126128
CompactMachines.LOGGER.warn("Warning: Compact Dimension was null! Cannot fetch internal state for machine neighbor change listener.");
127129
return;
128130
}
129131

130132
// Determine whether it's an immediate neighbor; if so, execute ...
131133
Arrays.stream(Direction.values())
132-
.filter(hd -> pos.offset(hd).equals(changedPos))
134+
.filter(hd -> pos.relative(hd).equals(changedPos))
133135
.findFirst()
134136
.ifPresent(facing -> {
135137
Set<BlockPos> tunnelsForMachineSide = TunnelHelper.getTunnelsForMachineSide(machine.machineId, serverWorld, facing);
136138
for (BlockPos tunnelPos : tunnelsForMachineSide) {
137-
TunnelWallTile tunnelTile = (TunnelWallTile) compactWorld.getTileEntity(tunnelPos);
139+
TunnelWallTile tunnelTile = (TunnelWallTile) compactWorld.getBlockEntity(tunnelPos);
138140
if (tunnelTile == null) continue;
139141

140-
compactWorld.notifyNeighborsOfStateChange(tunnelPos, Registration.BLOCK_TUNNEL_WALL.get());
142+
compactWorld.updateNeighborsAt(tunnelPos, Registration.BLOCK_TUNNEL_WALL.get());
141143

142144
ITunnelConnectionInfo connInfo = TunnelHelper.generateConnectionInfo(tunnelTile);
143145

@@ -146,7 +148,7 @@ public void neighborChanged(BlockState state, World world, BlockPos pos, Block c
146148
if (tunnelDefinition instanceof IRedstoneReaderTunnel) {
147149
// Send redstone changes into machine
148150
IRedstoneReaderTunnel rrt = (IRedstoneReaderTunnel) tunnelDefinition;
149-
int latestPower = world.getRedstonePower(changedPos, facing);
151+
int latestPower = world.getSignal(changedPos, facing);
150152
rrt.onPowerChanged(connInfo, latestPower);
151153
}
152154
});
@@ -159,10 +161,10 @@ public ItemStack getPickBlock(BlockState state, RayTraceResult target, IBlockRea
159161
Block given = CompactMachineUtil.getMachineBlockBySize(this.size);
160162
ItemStack stack = new ItemStack(given, 1);
161163

162-
CompoundNBT nbt = stack.getOrCreateChildTag("cm");
164+
CompoundNBT nbt = stack.getOrCreateTagElement("cm");
163165
nbt.putString("size", this.size.getName());
164166

165-
CompactMachineTile tileEntity = (CompactMachineTile) world.getTileEntity(pos);
167+
CompactMachineTile tileEntity = (CompactMachineTile) world.getBlockEntity(pos);
166168
if (tileEntity != null) {
167169
nbt.putInt("coords", tileEntity.machineId);
168170
}
@@ -189,39 +191,39 @@ public TileEntity createTileEntity(BlockState state, IBlockReader world) {
189191
}
190192

191193
@Override
192-
public void onPlayerDestroy(IWorld world, BlockPos pos, BlockState state) {
193-
if (world.isRemote()) {
194-
super.onPlayerDestroy(world, pos, state);
194+
public void destroy(IWorld world, BlockPos pos, BlockState state) {
195+
if (world.isClientSide()) {
196+
super.destroy(world, pos, state);
195197
return;
196198
}
197199

198-
if (!(world.getTileEntity(pos) instanceof CompactMachineTile)) {
200+
if (!(world.getBlockEntity(pos) instanceof CompactMachineTile)) {
199201
return;
200202
}
201203

202-
CompactMachineTile te = (CompactMachineTile) world.getTileEntity(pos);
204+
CompactMachineTile te = (CompactMachineTile) world.getBlockEntity(pos);
203205
// WorldSavedDataMachines.INSTANCE.removeMachinePosition(te.coords);
204206
//
205207
// BlockMachine.spawnItemWithNBT(world, pos, state.get(BlockMachine.SIZE), te);
206208
//
207209
// ChunkLoadingMachines.unforceChunk(te.coords);
208210

209-
super.onPlayerDestroy(world, pos, state);
211+
super.destroy(world, pos, state);
210212
}
211213

212214
@Override
213-
public void onBlockPlacedBy(World worldIn, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack stack) {
215+
public void setPlacedBy(World worldIn, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack stack) {
214216

215-
if (worldIn.isRemote())
217+
if (worldIn.isClientSide())
216218
return;
217219

218220
ServerWorld serverWorld = (ServerWorld) worldIn;
219221

220-
boolean hasProperTile = worldIn.getTileEntity(pos) instanceof CompactMachineTile;
222+
boolean hasProperTile = worldIn.getBlockEntity(pos) instanceof CompactMachineTile;
221223
if (!hasProperTile)
222224
return;
223225

224-
CompactMachineTile tile = (CompactMachineTile) worldIn.getTileEntity(pos);
226+
CompactMachineTile tile = (CompactMachineTile) worldIn.getBlockEntity(pos);
225227

226228
// The machine already has data for some reason
227229
if (tile.machineId != -1)
@@ -234,11 +236,11 @@ public void onBlockPlacedBy(World worldIn, BlockPos pos, BlockState state, @Null
234236
CompoundNBT nbt = stack.getOrCreateTag();
235237

236238
if (nbt.contains(Reference.CompactMachines.OWNER_NBT)) {
237-
tile.setOwner(nbt.getUniqueId(Reference.CompactMachines.OWNER_NBT));
239+
tile.setOwner(nbt.getUUID(Reference.CompactMachines.OWNER_NBT));
238240
}
239241

240242
if (!tile.getOwnerUUID().isPresent() && placer instanceof PlayerEntity) {
241-
tile.setOwner(placer.getUniqueID());
243+
tile.setOwner(placer.getUUID());
242244
}
243245

244246
if (nbt.contains("cm")) {
@@ -252,7 +254,7 @@ public void onBlockPlacedBy(World worldIn, BlockPos pos, BlockState state, @Null
252254
}
253255

254256
tile.doPostPlaced();
255-
tile.markDirty();
257+
tile.setChanged();
256258
}
257259

258260
// // TODO: Allow storing of schemas in machines
@@ -282,19 +284,19 @@ public void onBlockPlacedBy(World worldIn, BlockPos pos, BlockState state, @Null
282284

283285

284286
@Override
285-
public ActionResultType onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
286-
if (worldIn.isRemote())
287+
public ActionResultType use(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
288+
if (worldIn.isClientSide())
287289
return ActionResultType.SUCCESS;
288290

289291
// TODO - Open GUI with machine preview
290292
if (player instanceof ServerPlayerEntity) {
291293

292294
ServerPlayerEntity serverPlayer = (ServerPlayerEntity) player;
293295

294-
TileEntity te = worldIn.getTileEntity(pos);
296+
TileEntity te = worldIn.getBlockEntity(pos);
295297
CompactMachineTile tile = (CompactMachineTile) te;
296298

297-
ItemStack mainItem = player.getHeldItemMainhand();
299+
ItemStack mainItem = player.getMainHandItem();
298300
if (mainItem.isEmpty())
299301
return ActionResultType.PASS;
300302

0 commit comments

Comments
 (0)