Skip to content

Commit

Permalink
Re-implement Portal Radio conversion
Browse files Browse the repository at this point in the history
Signed-off-by: unilock <[email protected]>
  • Loading branch information
unilock committed Jan 31, 2024
1 parent 9d28297 commit 18519ce
Showing 1 changed file with 16 additions and 33 deletions.
49 changes: 16 additions & 33 deletions src/main/java/gg/moonflower/etched/core/Etched.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
import gg.moonflower.etched.core.registry.EtchedSounds;
import gg.moonflower.etched.core.registry.EtchedVillagers;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.entity.event.v1.ServerEntityWorldChangeEvents;
import net.minecraft.world.entity.item.ItemEntity;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import net.minecraftforge.common.ForgeConfigSpec;
import net.minecraftforge.fml.config.ModConfig;
import org.apache.commons.lang3.tuple.Pair;
Expand Down Expand Up @@ -56,41 +60,20 @@ public void onInitialize() {

SoundSourceManager.registerSource(new SoundCloudSource());
SoundSourceManager.registerSource(new BandcampSource());
}

/* TODO
private static void onGrindstoneChange(GrindstoneEvent.OnPlaceItem event) {
ItemStack top = event.getTopItem();
ItemStack bottom = event.getBottomItem();
if (top.isEmpty() == bottom.isEmpty()) {
return;
}

ItemStack stack = top.isEmpty() ? bottom : top;
if (AlbumCoverItem.getCoverStack(stack).isPresent()) {
ItemStack result = stack.copy();
result.setCount(1);
AlbumCoverItem.setCover(result, ItemStack.EMPTY);
event.setOutput(result);
}
}
*/

/* TODO
private static void onItemChangedDimension(EntityTravelToDimensionEvent event) {
if (event.getEntity() instanceof ItemEntity entity) {
if (event.getDimension() == Level.NETHER) {
ItemStack oldStack = entity.getItem();
if (oldStack.getItem() != EtchedBlocks.RADIO.get().asItem()) {
return;
ServerEntityWorldChangeEvents.AFTER_ENTITY_CHANGE_WORLD.register((originalEntity, newEntity, origin, destination) -> {
if (newEntity instanceof ItemEntity entity) {
if (destination.dimension() == Level.NETHER) {
ItemStack oldStack = entity.getItem();
if (oldStack.getItem() != EtchedBlocks.RADIO.asItem()) {
return;
}

ItemStack newStack = new ItemStack(EtchedBlocks.PORTAL_RADIO_ITEM, oldStack.getCount());
newStack.setTag(oldStack.getTag());
entity.setItem(newStack);
}
ItemStack newStack = new ItemStack(EtchedBlocks.PORTAL_RADIO_ITEM.get(), oldStack.getCount());
newStack.setTag(oldStack.getTag());
entity.setItem(newStack);
}
}
});
}
*/
}

0 comments on commit 18519ce

Please sign in to comment.