Skip to content

Commit

Permalink
Merge pull request #130 from juanmuscaria/staging
Browse files Browse the repository at this point in the history
Renamed bukkit package. Fine-tuned "api" jar. Added jitpack support.
  • Loading branch information
juanmuscaria authored May 28, 2023
2 parents a223cb4 + 5df69e9 commit 531c641
Show file tree
Hide file tree
Showing 399 changed files with 2,046 additions and 1,580 deletions.
27 changes: 26 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ apply plugin: 'base'
// Crucible tasks and subproject management is provided by this plugin
apply plugin: 'crucible'

// Needed for jitpack
apply plugin: 'maven-publish'

repositories {
maven {
name = "juanmuscaria"
Expand All @@ -48,7 +51,6 @@ minecraft {
mainClass = 'cpw.mods.fml.relauncher.ServerLaunchWrapper'
tweakClass = 'cpw.mods.fml.common.launcher.FMLTweaker'
installerVersion = "1.4"
srgExtra "PK: org/bukkit/craftbukkit org/bukkit/craftbukkit/v1_7_R4" // TODO: Perhaps rename the packages itself

// Repos used on the generated subprojects
repos = [
Expand Down Expand Up @@ -121,6 +123,29 @@ dependencies {
libraries 'it.unimi.dsi:fastutil:8.2.2'
}

packageApi {
include 'org/bukkit/**'
include 'org/spigotmc/**'
include 'thermos/**'
include 'co/aikar/**'
include 'io/github/crucible/**'
include 'net/minecraftforge/cauldron/**'
}

publishing {
publications {
crucible(MavenPublication) {
artifact packageApi
}
}
repositories {
maven {
url = buildDir.absolutePath + "/repo"
name = "filesystem"
}
}
}

packageServer {
manifest {
attributes([
Expand Down
2 changes: 2 additions & 0 deletions jitpack.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
before_install:
- ./gradlew setupCrucible
17 changes: 5 additions & 12 deletions patches/cpw/mods/fml/common/FMLCommonHandler.java.patch
Original file line number Diff line number Diff line change
@@ -1,24 +1,17 @@
--- ../src-base/minecraft/cpw/mods/fml/common/FMLCommonHandler.java
+++ ../src-work/minecraft/cpw/mods/fml/common/FMLCommonHandler.java
@@ -31,12 +31,17 @@
import net.minecraft.network.INetHandler;
import net.minecraft.network.NetworkManager;
import net.minecraft.server.MinecraftServer;
+import net.minecraft.server.management.ServerConfigurationManager;
import net.minecraft.world.World;
import net.minecraft.world.storage.SaveHandler;
import net.minecraft.world.storage.WorldInfo;
@@ -37,6 +37,10 @@

import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.Logger;
+import org.bukkit.Bukkit;
+import org.bukkit.craftbukkit.CraftWorld;
+import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
+import org.bukkit.entity.Player;
+import org.bukkit.event.player.PlayerChangedWorldEvent;

import com.google.common.base.Joiner;
import com.google.common.base.Strings;
@@ -385,10 +390,11 @@
@@ -385,10 +389,11 @@
{
return;
}
Expand All @@ -31,7 +24,7 @@
handlerSet.add(handler);
handlerToCheck = new WeakReference<SaveHandler>(handler); // for confirmBackupLevelDatUse
Map<String,NBTBase> additionalProperties = Maps.newHashMap();
@@ -496,7 +502,14 @@
@@ -496,7 +501,14 @@

public String getModName()
{
Expand All @@ -47,7 +40,7 @@
modNames.add("fml");
if (!noForge)
{
@@ -540,8 +553,21 @@
@@ -540,8 +552,21 @@
bus().post(new InputEvent.KeyInputEvent());
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
--- ../src-base/minecraft/cpw/mods/fml/common/network/internal/FMLNetworkHandler.java
+++ ../src-work/minecraft/cpw/mods/fml/common/network/internal/FMLNetworkHandler.java
@@ -47,6 +47,16 @@
@@ -47,6 +47,15 @@
import cpw.mods.fml.common.registry.EntityRegistry.EntityRegistration;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
+//Cauldron start
+import net.minecraft.inventory.IInventory;
+import net.minecraft.server.MinecraftServer;
+import net.minecraft.tileentity.TileEntity;
+import org.bukkit.craftbukkit.entity.CraftPlayer;
+import org.bukkit.craftbukkit.event.CraftEventFactory;
+import org.bukkit.craftbukkit.inventory.CraftInventory;
+import org.bukkit.craftbukkit.inventory.CraftInventoryView;
+import org.bukkit.craftbukkit.v1_7_R4.event.CraftEventFactory;
+import org.bukkit.craftbukkit.v1_7_R4.inventory.CraftInventory;
+import org.bukkit.craftbukkit.v1_7_R4.inventory.CraftInventoryView;
+import org.bukkit.event.inventory.InventoryType;
+// Cauldron end

public class FMLNetworkHandler
{
@@ -75,6 +85,31 @@
@@ -75,6 +84,31 @@
Container remoteGuiContainer = NetworkRegistry.INSTANCE.getRemoteGuiContainer(mc, entityPlayerMP, modGuiId, world, x, y, z);
if (remoteGuiContainer != null)
{
Expand Down Expand Up @@ -49,15 +48,15 @@
entityPlayerMP.getNextWindowId();
entityPlayerMP.closeContainer();
int windowId = entityPlayerMP.currentWindowId;
@@ -131,6 +166,7 @@
@@ -131,6 +165,7 @@
public static String checkModList(Map<String,String> listData, Side side)
{
List<ModContainer> rejects = Lists.newArrayList();
+ List<ModContainer> hackpacks = Lists.newArrayList();
for (Entry<ModContainer, NetworkModHolder> networkMod : NetworkRegistry.INSTANCE.registry().entrySet())
{
boolean result = networkMod.getValue().check(listData, side);
@@ -138,9 +174,15 @@
@@ -138,9 +173,15 @@
{
rejects.add(networkMod.getKey());
}
Expand Down
14 changes: 6 additions & 8 deletions patches/cpw/mods/fml/common/registry/EntityRegistry.java.patch
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
--- ../src-base/minecraft/cpw/mods/fml/common/registry/EntityRegistry.java
+++ ../src-work/minecraft/cpw/mods/fml/common/registry/EntityRegistry.java
@@ -41,6 +41,12 @@
@@ -41,6 +41,10 @@
import cpw.mods.fml.common.ModContainer;
import cpw.mods.fml.common.network.internal.FMLMessage.EntitySpawnMessage;

+// Cauldron start
+import net.minecraftforge.common.util.EnumHelper;
+import org.bukkit.craftbukkit.entity.CraftEntity;
+import org.bukkit.entity.EntityType;
+
+// Cauldron end
+
public class EntityRegistry
{
public class EntityRegistration
@@ -118,6 +124,8 @@
@@ -118,6 +122,8 @@
private ListMultimap<ModContainer, EntityRegistration> entityRegistrations = ArrayListMultimap.create();
private Map<String,ModContainer> entityNames = Maps.newHashMap();
private BiMap<Class<? extends Entity>, EntityRegistration> entityClassRegistrations = HashBiMap.create();
Expand All @@ -22,23 +20,23 @@
public static EntityRegistry instance()
{
return INSTANCE;
@@ -147,6 +155,7 @@
@@ -147,6 +153,7 @@
public static void registerModEntity(Class<? extends Entity> entityClass, String entityName, int id, Object mod, int trackingRange, int updateFrequency, boolean sendsVelocityUpdates)
{
instance().doModEntityRegistration(entityClass, entityName, id, mod, trackingRange, updateFrequency, sendsVelocityUpdates);
+ registerBukkitType(entityClass, entityName); // Cauldron - register EntityType for Bukkit
}

@SuppressWarnings("unchecked")
@@ -197,6 +206,7 @@
@@ -197,6 +204,7 @@
}
id = instance().validateAndClaimId(id);
EntityList.addMapping(entityClass, entityName, id);
+ registerBukkitType(entityClass, entityName); // Cauldron - register EntityType for Bukkit
}

private int validateAndClaimId(int id)
@@ -249,8 +259,38 @@
@@ -249,8 +257,38 @@
}
instance().validateAndClaimId(id);
EntityList.addMapping(entityClass, entityName, id, backgroundEggColour, foregroundEggColour);
Expand Down
16 changes: 12 additions & 4 deletions patches/net/minecraft/block/BlockCactus.java.patch
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
--- ../src-base/minecraft/net/minecraft/block/BlockCactus.java
+++ ../src-work/minecraft/net/minecraft/block/BlockCactus.java
@@ -17,6 +17,8 @@
@@ -7,7 +7,6 @@
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
-import net.minecraft.init.Blocks;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.DamageSource;
import net.minecraft.util.IIcon;
@@ -17,6 +16,8 @@
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.common.IPlantable;

+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
+import org.bukkit.craftbukkit.v1_7_R4.event.CraftEventFactory; // CraftBukkit
+
public class BlockCactus extends Block implements IPlantable
{
@SideOnly(Side.CLIENT)
@@ -47,9 +49,9 @@
@@ -47,9 +48,9 @@
{
int i1 = p_149674_1_.getBlockMetadata(p_149674_2_, p_149674_3_, p_149674_4_);

Expand All @@ -21,7 +29,7 @@
p_149674_1_.setBlockMetadataWithNotify(p_149674_2_, p_149674_3_, p_149674_4_, 0, 4);
this.onNeighborBlockChange(p_149674_1_, p_149674_2_, p_149674_3_ + 1, p_149674_4_, this);
}
@@ -135,6 +137,7 @@
@@ -135,6 +136,7 @@

public void onEntityCollidedWithBlock(World p_149670_1_, int p_149670_2_, int p_149670_3_, int p_149670_4_, Entity p_149670_5_)
{
Expand Down
7 changes: 4 additions & 3 deletions patches/net/minecraft/block/BlockCake.java.patch
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
--- ../src-base/minecraft/net/minecraft/block/BlockCake.java
+++ ../src-work/minecraft/net/minecraft/block/BlockCake.java
@@ -12,6 +12,10 @@
@@ -12,6 +12,11 @@
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
+// CraftBukkit start
+import net.minecraft.entity.player.EntityPlayerMP;
+import net.minecraft.network.play.server.S06PacketUpdateHealth;
+import org.bukkit.craftbukkit.v1_7_R4.event.CraftEventFactory;
+// CraftBukkit end

public class BlockCake extends Block
{
@@ -104,7 +108,17 @@
@@ -104,7 +109,17 @@
{
if (p_150036_5_.canEat(false))
{
- p_150036_5_.getFoodStats().addStats(2, 0.1F);
+ // CraftBukkit start
+ int oldFoodLevel = p_150036_5_.getFoodStats().foodLevel;
+ org.bukkit.event.entity.FoodLevelChangeEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callFoodLevelChangeEvent(p_150036_5_, 2 + oldFoodLevel);
+ org.bukkit.event.entity.FoodLevelChangeEvent event = CraftEventFactory.callFoodLevelChangeEvent(p_150036_5_, 2 + oldFoodLevel);
+
+ if (!event.isCancelled())
+ {
Expand Down
12 changes: 10 additions & 2 deletions patches/net/minecraft/block/BlockCocoa.java.patch
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
--- ../src-base/minecraft/net/minecraft/block/BlockCocoa.java
+++ ../src-work/minecraft/net/minecraft/block/BlockCocoa.java
@@ -51,7 +51,8 @@
@@ -17,6 +17,7 @@
import net.minecraft.util.MathHelper;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
+import org.bukkit.craftbukkit.v1_7_R4.event.CraftEventFactory;

public class BlockCocoa extends BlockDirectional implements IGrowable
{
@@ -51,7 +52,8 @@
if (i1 < 2)
{
++i1;
- p_149674_1_.setBlockMetadataWithNotify(p_149674_2_, p_149674_3_, p_149674_4_, i1 << 2 | getDirection(l), 2);
+ // CraftBukkit
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_, this, i1 << 2 | getDirection(l));
+ CraftEventFactory.handleBlockGrowEvent(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_, this, i1 << 2 | getDirection(l));
}
}
}
12 changes: 10 additions & 2 deletions patches/net/minecraft/block/BlockCrops.java.patch
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
--- ../src-base/minecraft/net/minecraft/block/BlockCrops.java
+++ ../src-work/minecraft/net/minecraft/block/BlockCrops.java
@@ -49,10 +49,9 @@
@@ -14,6 +14,7 @@
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
+import org.bukkit.craftbukkit.v1_7_R4.event.CraftEventFactory;

public class BlockCrops extends BlockBush implements IGrowable
{
@@ -49,10 +50,9 @@
{
float f = this.func_149864_n(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_);

Expand All @@ -9,7 +17,7 @@
{
- ++l;
- p_149674_1_.setBlockMetadataWithNotify(p_149674_2_, p_149674_3_, p_149674_4_, l, 2);
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_, this, ++l); // CraftBukkit
+ CraftEventFactory.handleBlockGrowEvent(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_, this, ++l); // CraftBukkit
}
}
}
12 changes: 10 additions & 2 deletions patches/net/minecraft/block/BlockDaylightDetector.java.patch
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
--- ../src-base/minecraft/net/minecraft/block/BlockDaylightDetector.java
+++ ../src-work/minecraft/net/minecraft/block/BlockDaylightDetector.java
@@ -73,6 +73,7 @@
@@ -13,6 +13,7 @@
import net.minecraft.world.EnumSkyBlock;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
+import org.bukkit.craftbukkit.v1_7_R4.event.CraftEventFactory;

public class BlockDaylightDetector extends BlockContainer
{
@@ -73,6 +74,7 @@

if (l != i1)
{
+ i1 = org.bukkit.craftbukkit.event.CraftEventFactory.callRedstoneChange(p_149957_1_, p_149957_2_, p_149957_3_, p_149957_4_, l, i1).getNewCurrent(); // CraftBukkit - Call BlockRedstoneEvent
+ i1 = CraftEventFactory.callRedstoneChange(p_149957_1_, p_149957_2_, p_149957_3_, p_149957_4_, l, i1).getNewCurrent(); // CraftBukkit - Call BlockRedstoneEvent
p_149957_1_.setBlockMetadataWithNotify(p_149957_2_, p_149957_3_, p_149957_4_, i1, 3);
}
}
11 changes: 6 additions & 5 deletions patches/net/minecraft/block/BlockDropper.java.patch
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
--- ../src-base/minecraft/net/minecraft/block/BlockDropper.java
+++ ../src-work/minecraft/net/minecraft/block/BlockDropper.java
@@ -13,6 +13,11 @@
@@ -13,6 +13,12 @@
import net.minecraft.tileentity.TileEntityHopper;
import net.minecraft.util.Facing;
import net.minecraft.world.World;
+// CraftBukkit start
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
+import org.bukkit.craftbukkit.v1_7_R4.inventory.CraftInventoryDoubleChest;
+import org.bukkit.craftbukkit.v1_7_R4.inventory.CraftItemStack;
+import org.bukkit.event.inventory.InventoryMoveItemEvent;
+import net.minecraft.inventory.InventoryLargeChest;
+// CraftBukkit end

public class BlockDropper extends BlockDispenser
{
@@ -38,7 +43,7 @@
@@ -38,7 +44,7 @@
return new TileEntityDropper();
}

Expand All @@ -21,7 +22,7 @@
{
BlockSourceImpl blocksourceimpl = new BlockSourceImpl(p_149941_1_, p_149941_2_, p_149941_3_, p_149941_4_);
TileEntityDispenser tileentitydispenser = (TileEntityDispenser)blocksourceimpl.getBlockTileEntity();
@@ -60,10 +65,53 @@
@@ -60,10 +66,53 @@

if (iinventory != null)
{
Expand All @@ -34,7 +35,7 @@
+ // Have to special case large chests as they work oddly
+ if (iinventory instanceof InventoryLargeChest)
{
+ destinationInventory = new org.bukkit.craftbukkit.inventory.CraftInventoryDoubleChest((InventoryLargeChest) iinventory);
+ destinationInventory = new CraftInventoryDoubleChest((InventoryLargeChest) iinventory);
+ }
+ else {
+ // Crucible start - support mod inventories, with no owners
Expand Down
2 changes: 1 addition & 1 deletion patches/net/minecraft/block/BlockFarmland.java.patch
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

+// CraftBukkit start
+import org.bukkit.event.entity.EntityInteractEvent;
+import org.bukkit.craftbukkit.event.CraftEventFactory;
+import org.bukkit.craftbukkit.v1_7_R4.event.CraftEventFactory;
+// CraftBukkit end
+
public class BlockFarmland extends Block
Expand Down
Loading

0 comments on commit 531c641

Please sign in to comment.