Skip to content

Commit

Permalink
bit a messy start
Browse files Browse the repository at this point in the history
  • Loading branch information
Jsinco committed Jan 21, 2025
1 parent 9865e28 commit 443a329
Show file tree
Hide file tree
Showing 7 changed files with 142 additions and 41 deletions.
11 changes: 9 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,16 @@ allprojects {
maven("https://repo.oraxen.com/releases") // Oraxen
maven("https://storehouse.okaeri.eu/repository/maven-public/") // Okaeri Config
maven("https://repo.papermc.io/repository/maven-public/") // PaperLib
maven("https://repo.dmulloy2.net/repository/public/") // ProtocolLib
}
}

//subprojects {
// dependencies {
// compileOnly("com.comphenix.protocol:ProtocolLib:5.1.0") // https://github.com/dmulloy2/ProtocolLib
// }
//}

dependencies {
// Spigot
compileOnly("org.spigotmc:spigot-api:1.20.2-R0.1-SNAPSHOT") {
Expand Down Expand Up @@ -116,8 +123,8 @@ dependencies {
compileOnly("nl.rutgerkok:blocklocker:1.10.4") // https://www.spigotmc.org/resources/blocklocker.3268/history
compileOnly("me.clip:placeholderapi:2.11.5") // https://www.spigotmc.org/resources/placeholderapi.6245/history
compileOnly("io.th0rgal:oraxen:1.163.0") // https://www.spigotmc.org/resources/%E2%98%84%EF%B8%8F-oraxen-custom-items-blocks-emotes-furniture-resourcepack-and-gui-1-18-1-21-3.72448/
compileOnly("com.github.LoneDev6:API-ItemsAdder:3.6.1") // https://www.spigotmc.org/resources/%E2%9C%A8itemsadder%E2%AD%90emotes-mobs-items-armors-hud-gui-emojis-blocks-wings-hats-liquids.73355/updates

compileOnly("com.github.LoneDev6:API-ItemsAdder:3.6.1") // https://www.spigotmc.org/resources/%E2%9C%A8itemsadder%E2%AD%90emotes-mobs-items-armors-hud-gui-emojis-blocks-wings-hats-liquids.73355
compileOnly("com.comphenix.protocol:ProtocolLib:5.1.0") // https://github.com/dmulloy2/ProtocolLib


testImplementation(platform("org.junit:junit-bom:5.9.1"))
Expand Down
1 change: 1 addition & 0 deletions nms/v1_21_3/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,5 @@ repositories {
dependencies {
implementation(project(":"))
paperweight.paperDevBundle("1.21.3-R0.1-SNAPSHOT")
compileOnly("com.comphenix.protocol:ProtocolLib:5.1.0") // https://github.com/dmulloy2/ProtocolLib
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Server;
import org.bukkit.block.Block;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.CraftWorld;

Expand All @@ -42,28 +43,38 @@ public class CustomBiomeAreaImplV1_21_3 extends CustomBiomeArea {

private Biome biome;

public CustomBiomeAreaImplV1_21_3(Location parentBiomeLocation) {
super(parentBiomeLocation);
public CustomBiomeAreaImplV1_21_3(Location parentBiomeLocation, String fogColor, String skyColor, String waterColor, String waterFogColor, String foliageColor, String grassColor) {
Block block=;
block.setBiome();

super(parentBiomeLocation, fogColor, skyColor, waterColor, waterFogColor, foliageColor, grassColor);
CraftWorld craftWorld = (CraftWorld) parentBiomeLocation.getWorld();
Biome parentBiome = craftWorld.getHandle().getBiome(new BlockPos(parentBiomeLocation.getBlockX(), parentBiomeLocation.getBlockY(), parentBiomeLocation.getBlockZ())).value();
BiomeSpecialEffects parentSpecialEffects = parentBiome.getSpecialEffects();



BiomeSpecialEffects specialEffects = new BiomeSpecialEffects.Builder()
.ambientAdditionsSound(parentSpecialEffects.getAmbientAdditionsSettings().orElse(null))
.ambientMoodSound(parentSpecialEffects.getAmbientMoodSettings().orElse(null))
.ambientLoopSound(parentSpecialEffects.getAmbientLoopSoundEvent().orElse(null))
.fogColor()
.skyColor()
.grassColorOverride()
.build()
.ambientAdditionsSound(parentSpecialEffects.getAmbientAdditionsSettings().get())
.ambientMoodSound(parentSpecialEffects.getAmbientMoodSettings().get())
.ambientLoopSound(parentSpecialEffects.getAmbientLoopSoundEvent().get())
.fogColor(hexToColor(fogColor))
.skyColor(hexToColor(skyColor))
.waterColor(hexToColor(waterColor))
.waterFogColor(hexToColor(waterFogColor))
.foliageColorOverride(hexToColor(foliageColor))
.grassColorOverride(hexToColor(grassColor))
.build();

this.biome = new Biome.BiomeBuilder()
.downfall(0.5F)
.temperature(parentBiome.getBaseTemperature())
.specialEffects()
.specialEffects(specialEffects)
.generationSettings(parentBiome.getGenerationSettings())
.hasPrecipitation(parentBiome.hasPrecipitation())
.mobSpawnSettings(parentBiome.getMobSettings())
.build();

}

@Override
Expand All @@ -81,33 +92,4 @@ public boolean isRegistered() {
return false;
}

@Override
public void setFogColor(String color) {

}

@Override
public void setSkyColor(String color) {

}

@Override
public void setWaterColor(String color) {

}

@Override
public void setWaterFogColor(String color) {

}

@Override
public void setFoliageColor(String color) {

}

@Override
public void setGrassColor(String color) {

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
* BreweryX Bukkit-Plugin for an alternate brewing process
* Copyright (C) 2024-2025 The Brewery Team
*
* This file is part of BreweryX.
*
* BreweryX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* BreweryX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with BreweryX. If not, see <http://www.gnu.org/licenses/gpl-3.0.html>.
*/

package com.dre.brewery;

import com.comphenix.protocol.PacketType;
import com.comphenix.protocol.ProtocolLibrary;
import com.comphenix.protocol.ProtocolManager;
import com.comphenix.protocol.events.ListenerPriority;
import com.comphenix.protocol.events.PacketAdapter;
import com.comphenix.protocol.events.PacketContainer;
import com.comphenix.protocol.events.PacketEvent;
import com.dre.brewery.packets.ChunkBiomePacketListener;
import net.minecraft.network.protocol.Packet;
import net.minecraft.network.protocol.game.ClientboundChunksBiomesPacket;
import net.minecraft.server.packs.repository.Pack;

public class ProtocolLibPacketListenerV1_21_3 implements ChunkBiomePacketListener<PacketContainer> {

private final ProtocolManager protocolManager;

public ProtocolLibPacketListenerV1_21_3() {
this.protocolManager = ProtocolLibrary.getProtocolManager();

protocolManager.addPacketListener(new PacketAdapter(BreweryPlugin.getInstance(),
ListenerPriority.NORMAL,
PacketType.Play.Server.CHUNKS_BIOMES) {
@Override
public void onPacketSending(PacketEvent event) {
// Something like, if cauldron is preset and xyz location, change the biome in that area to a custom biome
PacketContainer packet = event.getPacket();
packet.
}
});
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* BreweryX Bukkit-Plugin for an alternate brewing process
* Copyright (C) 2024-2025 The Brewery Team
*
* This file is part of BreweryX.
*
* BreweryX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* BreweryX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with BreweryX. If not, see <http://www.gnu.org/licenses/gpl-3.0.html>.
*/

package com.dre.brewery.packets;

public interface ChunkBiomePacketListener<T> {

T onServerSendChunkBiomePacket(T packet);
}
7 changes: 7 additions & 0 deletions src/main/java/com/dre/brewery/packets/CustomBiomeArea.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,11 @@ public CustomBiomeArea(Location parentBiomeLocation, String fogColor, String sky
public abstract String getName();
public abstract boolean isRegistered();


public int hexToColor(String hex) {
hex = hex.replace("#", "");

// Parse the hex string as an integer
return Integer.parseInt(hex, 16);
}
}
24 changes: 24 additions & 0 deletions src/main/java/com/dre/brewery/packets/CustomBiomeHandler.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* BreweryX Bukkit-Plugin for an alternate brewing process
* Copyright (C) 2024-2025 The Brewery Team
*
* This file is part of BreweryX.
*
* BreweryX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* BreweryX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with BreweryX. If not, see <http://www.gnu.org/licenses/gpl-3.0.html>.
*/

package com.dre.brewery.packets;

public class CustomBiomeHandler {
}

0 comments on commit 443a329

Please sign in to comment.