Skip to content

Commit 7c31d88

Browse files
committed
Update to 1.21.2-1.21.4
1 parent 5a2dd9d commit 7c31d88

File tree

3 files changed

+28
-15
lines changed

3 files changed

+28
-15
lines changed

gradle.properties

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
# Project Specifics
2-
projectVersion=0.8.3
2+
projectVersion=0.8.4
33
modrinthId=G9eJHDO2
44

55
# Minecraft
6-
minecraftVersion=1.21
7-
minecraftRequired=>=1.20.5- <1.21.2
8-
minecraftCompatible=1.20.5,1.20.6,1.21,1.21.1
9-
yarnMappings=1.21+build.7
10-
loaderVersion=0.15.11
11-
fabricApiVersion=0.100.6+1.21
12-
polymerVersion=0.9.4+1.21
6+
minecraftVersion=1.21.2
7+
minecraftRequired=>=1.21.2-
8+
minecraftCompatible=1.21.2,1.21.3,1.21.4
9+
yarnMappings=1.21.2+build.1
10+
loaderVersion=0.16.10
11+
fabricApiVersion=0.106.1+1.21.2
12+
polymerVersion=0.10.0+1.21.2
1313

1414
# Plugins
1515
systemProp.loomVersion=1.+

src/main/java/gay/ampflower/polysit/Main.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,13 @@
2727
import net.minecraft.entity.SpawnGroup;
2828
import net.minecraft.registry.Registries;
2929
import net.minecraft.registry.Registry;
30+
import net.minecraft.registry.RegistryKey;
31+
import net.minecraft.registry.RegistryKeys;
3032
import net.minecraft.server.network.ServerPlayerEntity;
3133
import net.minecraft.text.Text;
3234
import net.minecraft.util.ActionResult;
3335
import net.minecraft.util.Hand;
36+
import net.minecraft.util.Identifier;
3437
import net.minecraft.util.math.BlockPos;
3538
import net.minecraft.util.math.Direction;
3639
import net.minecraft.util.math.MathHelper;
@@ -309,8 +312,9 @@ public static ActionResult sit(World world, Entity entity, double seatX, double
309312
}
310313

311314
public static <T extends Entity> EntityType<T> registerEntity(String id, EntityType.Builder<T> type) {
312-
var built = type.build(id);
313-
Registry.register(Registries.ENTITY_TYPE, id, built);
315+
final var identifier = Identifier.of(id);
316+
final var built = type.build(RegistryKey.of(RegistryKeys.ENTITY_TYPE, identifier));
317+
Registry.register(Registries.ENTITY_TYPE, identifier, built);
314318
PolymerEntityUtils.registerType(built);
315319
return built;
316320
}

src/main/java/gay/ampflower/polysit/SeatEntity.java

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,13 @@
1515
import net.minecraft.entity.data.DataTracker;
1616
import net.minecraft.nbt.NbtCompound;
1717
import net.minecraft.network.packet.s2c.play.EntityAttributesS2CPacket;
18-
import net.minecraft.network.packet.s2c.play.EntitySpawnS2CPacket;
18+
import net.minecraft.registry.tag.DamageTypeTags;
1919
import net.minecraft.server.network.ServerPlayerEntity;
20+
import net.minecraft.server.world.ServerWorld;
2021
import net.minecraft.util.math.BlockPos;
2122
import net.minecraft.world.World;
23+
import org.jetbrains.annotations.Nullable;
24+
import xyz.nucleoid.packettweaker.PacketContext;
2225

2326
import java.util.Collection;
2427
import java.util.Collections;
@@ -45,7 +48,7 @@
4548
**/
4649
public class SeatEntity extends Entity implements PolymerEntity {
4750
private static final EntityAttributeInstance MAX_HEALTH_NULL = new EntityAttributeInstance(
48-
EntityAttributes.GENERIC_MAX_HEALTH, discard -> {
51+
EntityAttributes.MAX_HEALTH, discard -> {
4952
});
5053
private static final Collection<EntityAttributeInstance> MAX_HEALTH_NULL_SINGLE = Collections
5154
.singleton(MAX_HEALTH_NULL);
@@ -72,7 +75,7 @@ public SeatEntity(World world, double x, double y, double z) {
7275
* at a block.
7376
*/
7477
@Override
75-
public EntityType<?> getPolymerEntityType(ServerPlayerEntity player) {
78+
public EntityType<?> getPolymerEntityType(final PacketContext context) {
7679
return EntityType.ARMOR_STAND;
7780
}
7881

@@ -154,15 +157,21 @@ public void tick() {
154157
}
155158

156159
@Override
157-
public boolean damage(final DamageSource source, final float amount) {
158-
if (isInvulnerableTo(source)) {
160+
public boolean damage(final ServerWorld world, final DamageSource source, final float amount) {
161+
if (!source.isSourceCreativePlayer() && !source.isIn(DamageTypeTags.BYPASSES_INVULNERABILITY)) {
159162
return false;
160163
}
161164

162165
this.remove(RemovalReason.KILLED);
163166
return true;
164167
}
165168

169+
@Override
170+
public void onExplodedBy(@Nullable final Entity entity) {
171+
// Allows the seat to be destroyed by TNT.
172+
this.remove(RemovalReason.KILLED);
173+
}
174+
166175
protected boolean isDiscardable() {
167176
return this.getWorld().getBlockState(getAdjustedPos()).isAir();
168177
}

0 commit comments

Comments
 (0)