-
Notifications
You must be signed in to change notification settings - Fork 43
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
Showing
49 changed files
with
175 additions
and
225 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
29 changes: 29 additions & 0 deletions
29
src/main/java/net/id/paradiselost/mixin/entity/BoatEntityMixin.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,29 @@ | ||
package net.id.paradiselost.mixin.entity; | ||
|
||
import net.id.paradiselost.items.ParadiseLostItems; | ||
import net.minecraft.entity.vehicle.BoatEntity; | ||
import net.minecraft.item.Item; | ||
import org.objectweb.asm.Opcodes; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; | ||
|
||
@Mixin(BoatEntity.class) | ||
public abstract class BoatEntityMixin { | ||
@Shadow | ||
public abstract BoatEntity.Type getBoatType(); | ||
|
||
@Inject(method = "asItem", at = @At(value = "FIELD", target = "Lnet/minecraft/item/Items;OAK_BOAT:Lnet/minecraft/item/Item;", opcode = Opcodes.GETSTATIC), cancellable = true) | ||
private void checkCustomBoats(CallbackInfoReturnable<Item> cir) { | ||
BoatEntity.Type type = this.getBoatType(); | ||
if (type != BoatEntity.Type.OAK) { | ||
for (var entry : ParadiseLostItems.BOAT_SETS){ | ||
if (type == entry.type()){ | ||
cir.setReturnValue(entry.boat()); | ||
} | ||
} | ||
} | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
src/main/java/net/id/paradiselost/mixin/entity/BoatEntityTypeMixin.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,32 @@ | ||
package net.id.paradiselost.mixin.entity; | ||
|
||
import net.id.paradiselost.util.EnumExtender; | ||
import net.minecraft.block.Block; | ||
import net.minecraft.entity.vehicle.BoatEntity; | ||
import org.spongepowered.asm.mixin.Final; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Mutable; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
|
||
import java.util.Arrays; | ||
|
||
@Mixin(BoatEntity.Type.class) | ||
public class BoatEntityTypeMixin { | ||
@SuppressWarnings("ShadowTarget") | ||
@Shadow | ||
@Mutable | ||
@Final | ||
private static BoatEntity.Type[] field_7724; | ||
|
||
static { | ||
EnumExtender.register(BoatEntity.Type.class, (name, args) -> { | ||
BoatEntity.Type entry = (BoatEntity.Type) (Object) new BoatEntityTypeMixin(name, field_7724.length, (Block) args[0], (String) args[1]); | ||
field_7724 = Arrays.copyOf(field_7724, field_7724.length + 1); | ||
return field_7724[field_7724.length - 1] = entry; | ||
}); | ||
} | ||
|
||
private BoatEntityTypeMixin(String valueName, int ordinal, Block baseBlock, String name) { | ||
throw new AssertionError(); | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
src/main/java/net/id/paradiselost/mixin/entity/ChestBoatEntityMixin.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,34 @@ | ||
package net.id.paradiselost.mixin.entity; | ||
|
||
import net.id.paradiselost.items.ParadiseLostItems; | ||
import net.minecraft.entity.EntityType; | ||
import net.minecraft.entity.vehicle.BoatEntity; | ||
import net.minecraft.entity.vehicle.ChestBoatEntity; | ||
import net.minecraft.item.Item; | ||
import net.minecraft.world.World; | ||
import org.objectweb.asm.Opcodes; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; | ||
|
||
@Mixin(ChestBoatEntity.class) | ||
public class ChestBoatEntityMixin extends BoatEntity { | ||
|
||
public ChestBoatEntityMixin(EntityType<? extends BoatEntity> entityType, World world) { | ||
super(entityType, world); | ||
} | ||
|
||
@Inject(method = "asItem", at = @At(value = "FIELD", target = "Lnet/minecraft/item/Items;OAK_CHEST_BOAT:Lnet/minecraft/item/Item;", opcode = Opcodes.GETSTATIC), cancellable = true) | ||
private void checkCustomBoats(CallbackInfoReturnable<Item> cir) { | ||
BoatEntity.Type type = this.getBoatType(); | ||
if (type != BoatEntity.Type.OAK) { | ||
for (var entry : ParadiseLostItems.BOAT_SETS){ | ||
if (type == entry.type()){ | ||
cir.setReturnValue(entry.chestBoat()); | ||
} | ||
} | ||
} | ||
} | ||
} |
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 net.id.paradiselost.util; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
import java.util.function.BiFunction; | ||
|
||
public class EnumExtender { | ||
private static final Map<Class<? extends Enum<?>>, BiFunction<String, Object[], ? extends Enum<?>>> extensibles = new HashMap<>(); | ||
|
||
public static <T extends Enum<T>> void register(Class<T> extensible, BiFunction<String, Object[], T> callback) { | ||
extensibles.put(extensible, callback); | ||
} | ||
|
||
@SuppressWarnings("unchecked") | ||
public static <T extends Enum<T>> T add(Class<T> to, String name, Object... arguments) { | ||
if (extensibles.containsKey(to)) { | ||
try { | ||
return (T) extensibles.get(to).apply(name, arguments); | ||
} catch (ClassCastException | IndexOutOfBoundsException e) { | ||
throw new IllegalArgumentException("Invalid arguments for entry " + name + " of enum " + to + ". Arguments must match the enum constructor."); | ||
} | ||
} else { | ||
throw new UnsupportedOperationException("Attempted to extend inextensible enum " + to + ". Create a mixin for it from the template in EnumExtender."); | ||
} | ||
} | ||
} |
Binary file removed
BIN
-602 Bytes
src/main/resources/assets/paradise_lost/textures/entity/chest/crystal/normal.png
Binary file not shown.
Binary file removed
BIN
-631 Bytes
...in/resources/assets/paradise_lost/textures/entity/chest/crystal/normal_left.png
Binary file not shown.
Binary file removed
BIN
-669 Bytes
...n/resources/assets/paradise_lost/textures/entity/chest/crystal/normal_right.png
Binary file not shown.
Binary file removed
BIN
-1.27 KB
...main/resources/assets/paradise_lost/textures/entity/chest/golden_oak/normal.png
Binary file not shown.
Binary file removed
BIN
-1.38 KB
...resources/assets/paradise_lost/textures/entity/chest/golden_oak/normal_left.png
Binary file not shown.
Binary file removed
BIN
-1.47 KB
...esources/assets/paradise_lost/textures/entity/chest/golden_oak/normal_right.png
Binary file not shown.
Binary file removed
BIN
-581 Bytes
src/main/resources/assets/paradise_lost/textures/entity/chest/orange/normal.png
Binary file not shown.
Binary file removed
BIN
-639 Bytes
...ain/resources/assets/paradise_lost/textures/entity/chest/orange/normal_left.png
Binary file not shown.
Binary file removed
BIN
-664 Bytes
...in/resources/assets/paradise_lost/textures/entity/chest/orange/normal_right.png
Binary file not shown.
Binary file removed
BIN
-1.24 KB
src/main/resources/assets/paradise_lost/textures/entity/chest/skyroot/normal.png
Binary file not shown.
Binary file removed
BIN
-1.31 KB
...in/resources/assets/paradise_lost/textures/entity/chest/skyroot/normal_left.png
Binary file not shown.
Binary file removed
BIN
-1.34 KB
...n/resources/assets/paradise_lost/textures/entity/chest/skyroot/normal_right.png
Binary file not shown.
Binary file removed
BIN
-642 Bytes
src/main/resources/assets/paradise_lost/textures/entity/chest/wisteria/normal.png
Binary file not shown.
Binary file removed
BIN
-670 Bytes
...n/resources/assets/paradise_lost/textures/entity/chest/wisteria/normal_left.png
Binary file not shown.
Binary file removed
BIN
-692 Bytes
.../resources/assets/paradise_lost/textures/entity/chest/wisteria/normal_right.png
Binary file not shown.
Binary file removed
BIN
-173 Bytes
src/main/resources/assets/paradise_lost/textures/entity/corvid/rook1.png
Binary file not shown.
Binary file removed
BIN
-170 Bytes
src/main/resources/assets/paradise_lost/textures/entity/corvid/rook2.png
Binary file not shown.
Binary file removed
BIN
-183 Bytes
src/main/resources/assets/paradise_lost/textures/entity/corvid/rook3.png
Binary file not shown.
Binary file removed
BIN
-199 Bytes
src/main/resources/assets/paradise_lost/textures/entity/corvid/rook4.png
Binary file not shown.
Binary file removed
BIN
-93 Bytes
src/main/resources/assets/paradise_lost/textures/entity/corvid/rook_eye1.png
Binary file not shown.
Binary file removed
BIN
-92 Bytes
src/main/resources/assets/paradise_lost/textures/entity/corvid/rook_eye2.png
Binary file not shown.
Binary file removed
BIN
-101 Bytes
src/main/resources/assets/paradise_lost/textures/entity/corvid/rook_eye3.png
Binary file not shown.
Binary file removed
BIN
-97 Bytes
src/main/resources/assets/paradise_lost/textures/entity/corvid/rook_eye4.png
Binary file not shown.
Binary file removed
BIN
-166 Bytes
.../resources/assets/paradise_lost/textures/entity/projectile/dart/poison_dart.png
Binary file not shown.
Binary file removed
BIN
-193 Bytes
...esources/assets/paradise_lost/textures/entity/projectile/dart/poison_needle.png
Binary file not shown.
This file was deleted.
Oops, something went wrong.
20 changes: 0 additions & 20 deletions
20
src/main/resources/data/paradise_lost/loot_tables/blocks/golden_oak_chest.json
This file was deleted.
Oops, something went wrong.
20 changes: 0 additions & 20 deletions
20
src/main/resources/data/paradise_lost/loot_tables/blocks/orange_chest.json
This file was deleted.
Oops, something went wrong.
20 changes: 0 additions & 20 deletions
20
src/main/resources/data/paradise_lost/loot_tables/blocks/skyroot_chest.json
This file was deleted.
Oops, something went wrong.
20 changes: 0 additions & 20 deletions
20
src/main/resources/data/paradise_lost/loot_tables/blocks/wisteria_chest.json
This file was deleted.
Oops, something went wrong.
16 changes: 0 additions & 16 deletions
16
src/main/resources/data/paradise_lost/recipes/aurel_chest.json
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.