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
18 changed files
with
174 additions
and
4 deletions.
There are no files selected for viewing
4 changes: 2 additions & 2 deletions
4
src/generated/resources/.cache/c622617f6fabf890a00b9275cd5f643584a8a2c8
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,2 +1,2 @@ | ||
// 1.20.1 2024-04-03T16:31:59.8068017 Languages: en_us | ||
5c069c5699d7744b9335b43474580a66c22666e2 assets/deeperdarker/lang/en_us.json | ||
// 1.20.1 2024-05-12T13:17:34.6173826 Languages: en_us | ||
569b4e328a6e96d049c25028a661562ac09a4161 assets/deeperdarker/lang/en_us.json |
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
19 changes: 19 additions & 0 deletions
19
src/main/java/com/kyanite/deeperdarker/content/AncientPaintingVariants.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,19 @@ | ||
package com.kyanite.deeperdarker.content; | ||
|
||
import com.kyanite.deeperdarker.DeeperDarker; | ||
import net.minecraft.world.entity.decoration.PaintingVariant; | ||
import net.minecraftforge.registries.DeferredRegister; | ||
import net.minecraftforge.registries.ForgeRegistries; | ||
import net.minecraftforge.registries.RegistryObject; | ||
|
||
public class AncientPaintingVariants { | ||
public static final DeferredRegister<PaintingVariant> PAINTINGS = DeferredRegister.create(ForgeRegistries.PAINTING_VARIANTS, DeeperDarker.MOD_ID); | ||
|
||
public static final RegistryObject<PaintingVariant> ABSTRACTION = PAINTINGS.register("abstraction", () -> new PaintingVariant(32, 32)); | ||
public static final RegistryObject<PaintingVariant> ADVENTURE = PAINTINGS.register("adventure", () -> new PaintingVariant(64, 16)); | ||
public static final RegistryObject<PaintingVariant> CARROT = PAINTINGS.register("carrot", () -> new PaintingVariant(32, 16)); | ||
public static final RegistryObject<PaintingVariant> CLOUDS = PAINTINGS.register("clouds", () -> new PaintingVariant(64, 16)); | ||
public static final RegistryObject<PaintingVariant> ECHOER = PAINTINGS.register("echoer", () -> new PaintingVariant(16, 16)); | ||
public static final RegistryObject<PaintingVariant> MILLIPEDE = PAINTINGS.register("millipede", () -> new PaintingVariant(32, 32)); | ||
public static final RegistryObject<PaintingVariant> OOZE = PAINTINGS.register("ooze", () -> new PaintingVariant(16, 16)); | ||
} |
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
52 changes: 52 additions & 0 deletions
52
src/main/java/com/kyanite/deeperdarker/mixin/HangingEntityItemMixin.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,52 @@ | ||
package com.kyanite.deeperdarker.mixin; | ||
|
||
import com.kyanite.deeperdarker.util.DDTags; | ||
import net.minecraft.ChatFormatting; | ||
import net.minecraft.nbt.CompoundTag; | ||
import net.minecraft.network.chat.Component; | ||
import net.minecraft.util.Mth; | ||
import net.minecraft.world.entity.EntityType; | ||
import net.minecraft.world.entity.decoration.HangingEntity; | ||
import net.minecraft.world.entity.decoration.Painting; | ||
import net.minecraft.world.item.HangingEntityItem; | ||
import net.minecraft.world.item.ItemStack; | ||
import net.minecraft.world.item.TooltipFlag; | ||
import net.minecraft.world.level.Level; | ||
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.CallbackInfo; | ||
|
||
import java.util.List; | ||
|
||
@Mixin(HangingEntityItem.class) | ||
public abstract class HangingEntityItemMixin { | ||
private static final Component TOOLTIP_RANDOM_VARIANT = Component.translatable("painting.random").withStyle(ChatFormatting.GRAY); | ||
@Shadow | ||
private EntityType<? extends HangingEntity> type; | ||
|
||
@Inject(method = "appendHoverText", at = @At("HEAD"), cancellable = true) | ||
public void appendHoverText(ItemStack stack, Level level, List<Component> tooltips, TooltipFlag isAdvanced, CallbackInfo ci) { | ||
if(this.type == EntityType.PAINTING) { | ||
CompoundTag tag = stack.getTag(); | ||
if(tag != null && tag.contains("EntityTag", 10)) { | ||
CompoundTag entityTag = tag.getCompound("EntityTag"); | ||
if(Painting.loadVariant(entityTag).get().is(DDTags.Misc.ANCIENT_PAINTING)) { | ||
Painting.loadVariant(entityTag).ifPresentOrElse((variantHolder) -> { | ||
|
||
variantHolder.unwrapKey().ifPresent((variant) -> { | ||
tooltips.add(Component.translatable(variant.location().toLanguageKey("painting", "title")).withStyle(ChatFormatting.YELLOW)); | ||
tooltips.add(Component.translatable(variant.location().toLanguageKey("painting", "author")).withStyle(ChatFormatting.GRAY).withStyle(ChatFormatting.OBFUSCATED)); | ||
}); | ||
tooltips.add(Component.translatable("painting.dimensions", Mth.positiveCeilDiv(variantHolder.value().getWidth(), 16), Mth.positiveCeilDiv(variantHolder.value().getHeight(), 16))); | ||
}, () -> tooltips.add(TOOLTIP_RANDOM_VARIANT)); | ||
|
||
ci.cancel(); | ||
} | ||
} else if(isAdvanced.isCreative()) { | ||
tooltips.add(TOOLTIP_RANDOM_VARIANT); | ||
} | ||
} | ||
} | ||
} |
54 changes: 54 additions & 0 deletions
54
src/main/java/com/kyanite/deeperdarker/mixin/PaintingMixin.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,54 @@ | ||
package com.kyanite.deeperdarker.mixin; | ||
|
||
import com.kyanite.deeperdarker.util.DDTags; | ||
import net.minecraft.core.Holder; | ||
import net.minecraft.nbt.CompoundTag; | ||
import net.minecraft.sounds.SoundEvents; | ||
import net.minecraft.world.entity.Entity; | ||
import net.minecraft.world.entity.EntityType; | ||
import net.minecraft.world.entity.decoration.HangingEntity; | ||
import net.minecraft.world.entity.decoration.Painting; | ||
import net.minecraft.world.entity.decoration.PaintingVariant; | ||
import net.minecraft.world.entity.item.ItemEntity; | ||
import net.minecraft.world.entity.player.Player; | ||
import net.minecraft.world.item.ItemStack; | ||
import net.minecraft.world.item.Items; | ||
import net.minecraft.world.level.GameRules; | ||
import net.minecraft.world.level.Level; | ||
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.CallbackInfo; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; | ||
|
||
@Mixin(Painting.class) | ||
public abstract class PaintingMixin extends HangingEntity { | ||
protected PaintingMixin(EntityType<? extends HangingEntity> pEntityType, Level pLevel) { | ||
super(pEntityType, pLevel); | ||
} | ||
|
||
@Shadow | ||
public abstract Holder<PaintingVariant> getVariant(); | ||
|
||
@Inject(method = "dropItem", at = @At("HEAD"), cancellable = true) | ||
public void dropItem(Entity entity, CallbackInfo cir) { | ||
if(getVariant().is(DDTags.Misc.ANCIENT_PAINTING) && this.level().getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS)) { | ||
this.playSound(SoundEvents.PAINTING_BREAK, 1, 1); | ||
if(entity instanceof Player player && player.getAbilities().instabuild) return; | ||
|
||
ItemEntity itemEntity = this.spawnAtLocation(Items.PAINTING); | ||
CompoundTag tag = itemEntity.getItem().getOrCreateTagElement("EntityTag"); | ||
Painting.storeVariant(tag, getVariant()); | ||
cir.cancel(); | ||
} | ||
} | ||
|
||
@Inject(method = "getPickResult", at = @At("RETURN")) | ||
public void getPickResult(CallbackInfoReturnable<ItemStack> cir) { | ||
if(getVariant().is(DDTags.Misc.ANCIENT_PAINTING)) { | ||
CompoundTag tag = cir.getReturnValue().getOrCreateTagElement("EntityTag"); | ||
Painting.storeVariant(tag, getVariant()); | ||
} | ||
} | ||
} |
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
Binary file added
BIN
+2.4 KB
src/main/resources/assets/deeperdarker/textures/painting/abstraction.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.01 KB
src/main/resources/assets/deeperdarker/textures/painting/adventure.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+880 Bytes
src/main/resources/assets/deeperdarker/textures/painting/carrot.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+879 Bytes
src/main/resources/assets/deeperdarker/textures/painting/clouds.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+624 Bytes
src/main/resources/assets/deeperdarker/textures/painting/echoer.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.02 KB
src/main/resources/assets/deeperdarker/textures/painting/millipede.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions
11
src/main/resources/data/deeperdarker/tags/painting_variant/ancient_painting.json
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,11 @@ | ||
{ | ||
"values": [ | ||
"deeperdarker:abstraction", | ||
"deeperdarker:adventure", | ||
"deeperdarker:carrot", | ||
"deeperdarker:clouds", | ||
"deeperdarker:echoer", | ||
"deeperdarker:millipede", | ||
"deeperdarker:ooze" | ||
] | ||
} |
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