-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First few features of 1.0 beta rewrite
- Electronic Jukebox/Note Block - Audio cables for connecting devices - Loudspeakers no longer use radio - Most features of the mod are no longer present, will be re-added later
- Loading branch information
1 parent
d303c38
commit 5d8a2a5
Showing
402 changed files
with
3,266 additions
and
7,329 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,15 @@ | ||
org.gradle.jvmargs=-Xmx1G | ||
|
||
minecraft_version=1.18.2 | ||
yarn_mappings=1.18.2+build.2 | ||
loader_version=0.13.3 | ||
minecraft_version=1.20.1 | ||
yarn_mappings=1.20.1+build.9 | ||
loader_version=0.14.21 | ||
|
||
#Fabric api | ||
fabric_version=0.48.0+1.18.2 | ||
fabric_version=0.84.0+1.20.1 | ||
|
||
mod_version = 0.3+1.18.2 | ||
mod_version = 1.0.0-beta.1 | ||
maven_group = io.github.foundationgames | ||
archives_base_name = phonos | ||
|
||
arrp_version=0.5.7 | ||
libgui_version=5.2.0+1.18 | ||
jsonem_version=0.1.1 | ||
jsonem_version=0.2.1+1.20 | ||
|
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,5 +1,5 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1-bin.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
76 changes: 38 additions & 38 deletions
76
src/main/java/io/github/foundationgames/phonos/Phonos.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 |
---|---|---|
@@ -1,69 +1,69 @@ | ||
package io.github.foundationgames.phonos; | ||
|
||
import io.github.foundationgames.phonos.block.PhonosBlocks; | ||
import io.github.foundationgames.phonos.block.entity.RadioJukeboxBlockEntity; | ||
import io.github.foundationgames.phonos.item.ItemGroupQueue; | ||
import io.github.foundationgames.phonos.item.PhonosItems; | ||
import io.github.foundationgames.phonos.mixin.PersistentStateManagerAccess; | ||
import io.github.foundationgames.phonos.network.PayloadPackets; | ||
import io.github.foundationgames.phonos.resource.PhonosData; | ||
import io.github.foundationgames.phonos.screen.CustomMusicDiscGuiDescription; | ||
import io.github.foundationgames.phonos.screen.RadioJukeboxGuiDescription; | ||
import io.github.foundationgames.phonos.util.PhonosUtil; | ||
import io.github.foundationgames.phonos.village.TechnicianVillagerProfession; | ||
import io.github.foundationgames.phonos.world.RadioChannelState; | ||
import io.github.foundationgames.phonos.sound.SoundStorage; | ||
import io.github.foundationgames.phonos.sound.emitter.SoundEmitter; | ||
import io.github.foundationgames.phonos.sound.emitter.SoundEmitterStorage; | ||
import io.github.foundationgames.phonos.world.sound.InputPlugPoint; | ||
import io.github.foundationgames.phonos.world.sound.data.SoundDataTypes; | ||
import net.fabricmc.api.ModInitializer; | ||
import net.fabricmc.fabric.api.client.itemgroup.FabricItemGroupBuilder; | ||
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerBlockEntityEvents; | ||
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents; | ||
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents; | ||
import net.fabricmc.fabric.api.screenhandler.v1.ScreenHandlerRegistry; | ||
import net.minecraft.item.ItemGroup; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.screen.ScreenHandlerContext; | ||
import net.minecraft.screen.ScreenHandlerType; | ||
import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroup; | ||
import net.minecraft.registry.Registries; | ||
import net.minecraft.registry.Registry; | ||
import net.minecraft.util.Identifier; | ||
import net.minecraft.util.math.BlockPos; | ||
import org.apache.logging.log4j.LogManager; | ||
import org.apache.logging.log4j.Logger; | ||
|
||
public class Phonos implements ModInitializer { | ||
public static final Logger LOG = LogManager.getLogger("phonos"); | ||
|
||
public static final ItemGroup PHONOS_ITEM_GROUP = FabricItemGroupBuilder.build( | ||
id("phonos"), | ||
() -> new ItemStack(PhonosBlocks.LOUDSPEAKER)); | ||
public static final ItemGroup PHONOS_EXTRAS_GROUP = FabricItemGroupBuilder.build( | ||
id("extras"), | ||
() -> new ItemStack(PhonosBlocks.SPEAK_O_LANTERN)); | ||
|
||
public static final ScreenHandlerType<RadioJukeboxGuiDescription> RADIO_JUKEBOX_HANDLER = ScreenHandlerRegistry.registerExtended(Phonos.id("radio_jukebox"), (syncId, playerInv, buf) -> { | ||
RadioJukeboxBlockEntity be = null; | ||
BlockPos p = buf.readBlockPos(); | ||
if(playerInv.player.world.getBlockEntity(p) instanceof RadioJukeboxBlockEntity) be = (RadioJukeboxBlockEntity)playerInv.player.world.getBlockEntity(p); | ||
return new RadioJukeboxGuiDescription(syncId, playerInv, ScreenHandlerContext.EMPTY, be); | ||
}); | ||
public static final ScreenHandlerType<CustomMusicDiscGuiDescription> CUSTOM_DISC_HANDLER = ScreenHandlerRegistry.registerExtended(Phonos.id("custom_music_disc"), (syncId, playerInv, buf) -> { | ||
int slot = buf.readInt(); | ||
return new CustomMusicDiscGuiDescription(syncId, playerInv, slot); | ||
}); | ||
public static final ItemGroupQueue PHONOS_ITEMS = new ItemGroupQueue(id("phonos")); | ||
|
||
@Override | ||
public void onInitialize() { | ||
Registry.register(Registries.ITEM_GROUP, PHONOS_ITEMS.id, FabricItemGroup.builder() | ||
.icon(PhonosBlocks.LOUDSPEAKER.asItem()::getDefaultStack) | ||
.displayName(PHONOS_ITEMS.displayName()) | ||
.entries(PHONOS_ITEMS) | ||
.build()); | ||
|
||
PayloadPackets.initCommon(); | ||
|
||
PhonosBlocks.init(); | ||
PhonosItems.init(); | ||
TechnicianVillagerProfession.init(); | ||
|
||
PhonosData.registerData(); | ||
SoundDataTypes.init(); | ||
InputPlugPoint.init(); | ||
|
||
ServerLifecycleEvents.SERVER_STARTED.register(e -> { | ||
SoundStorage.serverReset(); | ||
SoundEmitterStorage.serverReset(); | ||
}); | ||
ServerTickEvents.END_WORLD_TICK.register(world -> SoundStorage.getInstance(world).tick(world)); | ||
|
||
ServerTickEvents.END_WORLD_TICK.register(world -> { | ||
var pStates = world.getPersistentStateManager(); | ||
if (((PersistentStateManagerAccess)pStates).phonos$getLoadedStates().containsKey(RadioChannelState.ID)) { | ||
PhonosUtil.getRadioState(world).tick(); | ||
ServerBlockEntityEvents.BLOCK_ENTITY_LOAD.register((be, world) -> { | ||
if (be instanceof SoundEmitter p) { | ||
SoundEmitterStorage.getInstance(world).addEmitter(p); | ||
} | ||
}); | ||
ServerBlockEntityEvents.BLOCK_ENTITY_UNLOAD.register((be, world) -> { | ||
if (be instanceof SoundEmitter p) { | ||
SoundEmitterStorage.getInstance(world).removeEmitter(p); | ||
} | ||
}); | ||
} | ||
|
||
public static Identifier id(String path) { | ||
return new Identifier("phonos", path); | ||
} | ||
|
||
public static float getPhonosVolume() { | ||
return 1; | ||
} | ||
} |
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
Oops, something went wrong.