Skip to content
Permalink
Browse files

Add support for Minecraft 1.15

  • Loading branch information
PseudoKnight committed Dec 11, 2019
1 parent b6aa64b commit 7f0017181a7a9fd186dcde6b75319cc8194dec0d
Showing with 376 additions and 18 deletions.
  1. +1 −1 pom.xml
  2. +4 −0 src/main/java/com/laytonsmith/abstraction/MCComplexRecipe.java
  3. +8 −0 src/main/java/com/laytonsmith/abstraction/blocks/MCBeehive.java
  4. +10 −0 src/main/java/com/laytonsmith/abstraction/bukkit/BukkitConvertor.java
  5. +39 −0 src/main/java/com/laytonsmith/abstraction/bukkit/BukkitMCComplexRecipe.java
  6. +4 −0 src/main/java/com/laytonsmith/abstraction/bukkit/BukkitMCWorld.java
  7. +40 −0 src/main/java/com/laytonsmith/abstraction/bukkit/blocks/BukkitMCBeehive.java
  8. +84 −0 src/main/java/com/laytonsmith/abstraction/bukkit/entities/BukkitMCBee.java
  9. +17 −0 src/main/java/com/laytonsmith/abstraction/entities/MCBee.java
  10. +1 −0 src/main/java/com/laytonsmith/abstraction/enums/MCEntityType.java
  11. +7 −2 src/main/java/com/laytonsmith/abstraction/enums/MCGameRule.java
  12. +1 −0 src/main/java/com/laytonsmith/abstraction/enums/MCMobs.java
  13. +4 −0 src/main/java/com/laytonsmith/abstraction/enums/MCParticle.java
  14. +15 −2 src/main/java/com/laytonsmith/abstraction/enums/MCPlayerStatistic.java
  15. +1 −0 src/main/java/com/laytonsmith/abstraction/enums/MCRecipeType.java
  16. +39 −12 src/main/java/com/laytonsmith/abstraction/enums/MCSound.java
  17. +2 −0 src/main/java/com/laytonsmith/abstraction/enums/MCVersion.java
  18. +2 −1 src/main/java/com/laytonsmith/abstraction/enums/bukkit/BukkitMCSound.java
  19. +19 −0 src/main/java/com/laytonsmith/core/ObjectGenerator.java
  20. +58 −0 src/main/java/com/laytonsmith/core/functions/EntityManagement.java
  21. +8 −0 src/main/java/com/laytonsmith/core/functions/PlayerManagement.java
  22. +8 −0 src/main/resources/functionDocs/entity_spec
  23. +4 −0 src/main/resources/functionDocs/get_itemmeta
@@ -173,7 +173,7 @@
<!-- GPL -->
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.14.3-SNAPSHOT</version>
<version>1.15-R0.1-SNAPSHOT</version>
</dependency>

<!-- Used for storing and retreiving Constructs in a storage transparent medium: JSONs -->
@@ -0,0 +1,4 @@
package com.laytonsmith.abstraction;

public interface MCComplexRecipe extends MCRecipe {
}
@@ -0,0 +1,8 @@
package com.laytonsmith.abstraction.blocks;

import com.laytonsmith.abstraction.MCLocation;

public interface MCBeehive extends MCBlockState {
MCLocation getFlowerLocation();
void setFlowerLocation(MCLocation loc);
}
@@ -31,6 +31,7 @@
import com.laytonsmith.abstraction.blocks.MCMaterial;
import com.laytonsmith.abstraction.bukkit.blocks.BukkitMCBanner;
import com.laytonsmith.abstraction.bukkit.blocks.BukkitMCBeacon;
import com.laytonsmith.abstraction.bukkit.blocks.BukkitMCBeehive;
import com.laytonsmith.abstraction.bukkit.blocks.BukkitMCBlockState;
import com.laytonsmith.abstraction.bukkit.blocks.BukkitMCBrewingStand;
import com.laytonsmith.abstraction.bukkit.blocks.BukkitMCContainer;
@@ -96,6 +97,7 @@
import org.bukkit.attribute.AttributeModifier;
import org.bukkit.block.Banner;
import org.bukkit.block.Beacon;
import org.bukkit.block.Beehive;
import org.bukkit.block.BlockState;
import org.bukkit.block.BrewingStand;
import org.bukkit.block.Container;
@@ -125,6 +127,7 @@
import org.bukkit.entity.minecart.CommandMinecart;
import org.bukkit.inventory.BlastingRecipe;
import org.bukkit.inventory.CampfireRecipe;
import org.bukkit.inventory.ComplexRecipe;
import org.bukkit.inventory.FurnaceRecipe;
import org.bukkit.inventory.InventoryHolder;
import org.bukkit.inventory.ItemStack;
@@ -518,6 +521,9 @@ public static MCBlockState BukkitGetCorrectBlockState(BlockState bs) {
if(Static.getServer().getMinecraftVersion().gte(MCVersion.MC1_14) && bs instanceof Lectern) {
return new BukkitMCLectern((Lectern) bs);
}
if(Static.getServer().getMinecraftVersion().gte(MCVersion.MC1_15) && bs instanceof Beehive) {
return new BukkitMCBeehive((Beehive) bs);
}
return new BukkitMCBlockState(bs);
}

@@ -682,6 +688,8 @@ public MCRecipe GetNewRecipe(String key, MCRecipeType type, MCItemStack result)
return new BukkitMCCookingRecipe(new SmokingRecipe(nskey, is, Material.AIR, 0.0F, 200), type);
case STONECUTTING:
return new BukkitMCStonecuttingRecipe(new StonecuttingRecipe(nskey, is, Material.AIR));
case COMPLEX:
throw new IllegalArgumentException("Unable to generate recipe type: " + type.name());
}
} catch (NoClassDefFoundError ex) {
// doesn't exist on this version.
@@ -706,6 +714,8 @@ public static MCRecipe BukkitGetRecipe(Recipe r) {
return new BukkitMCCookingRecipe(r, MCRecipeType.SMOKING);
} else if(r instanceof StonecuttingRecipe) {
return new BukkitMCStonecuttingRecipe((StonecuttingRecipe) r);
} else if(Static.getServer().getMinecraftVersion().gte(MCVersion.MC1_15) && r instanceof ComplexRecipe) {
return new BukkitMCComplexRecipe(r);
}
}
if(r instanceof ShapelessRecipe) {
@@ -0,0 +1,39 @@
package com.laytonsmith.abstraction.bukkit;

import com.laytonsmith.abstraction.MCComplexRecipe;
import com.laytonsmith.abstraction.MCItemStack;
import com.laytonsmith.abstraction.enums.MCRecipeType;
import org.bukkit.Keyed;
import org.bukkit.inventory.Recipe;

public class BukkitMCComplexRecipe extends BukkitMCRecipe implements MCComplexRecipe {

public BukkitMCComplexRecipe(Recipe recipe) {
super(recipe);
}

@Override
public String getKey() {
return ((Keyed) getHandle()).getKey().getKey();
}

@Override
public MCRecipeType getRecipeType() {
return MCRecipeType.COMPLEX;
}

@Override
public String getGroup() {
return null;
}

@Override
public void setGroup(String group) {
// complex recipes are basically dummy recipes with no group
}

@Override
public MCItemStack getResult() {
return new BukkitMCItemStack(((Recipe) getHandle()).getResult());
}
}
@@ -74,6 +74,7 @@
import org.bukkit.block.BlockFace;
import org.bukkit.block.data.BlockData;
import org.bukkit.entity.Bat;
import org.bukkit.entity.Bee;
import org.bukkit.entity.Blaze;
import org.bukkit.entity.CaveSpider;
import org.bukkit.entity.Chicken;
@@ -498,6 +499,9 @@ public CArray spawnMob(MCMobs name, String subClass, int qty, MCLocation l, Targ
case BAT:
mobType = Bat.class;
break;
case BEE:
mobType = Bee.class;
break;
case BLAZE:
mobType = Blaze.class;
break;
@@ -0,0 +1,40 @@
package com.laytonsmith.abstraction.bukkit.blocks;

import com.laytonsmith.abstraction.MCLocation;
import com.laytonsmith.abstraction.blocks.MCBeehive;
import com.laytonsmith.abstraction.bukkit.BukkitMCLocation;
import org.bukkit.Location;
import org.bukkit.block.Beehive;

public class BukkitMCBeehive extends BukkitMCBlockState implements MCBeehive {

Beehive bh;

public BukkitMCBeehive(Beehive hive) {
super(hive);
this.bh = hive;
}

@Override
public Beehive getHandle() {
return bh;
}

@Override
public MCLocation getFlowerLocation() {
Location loc = bh.getFlower();
if(loc == null) {
return null;
}
return new BukkitMCLocation(loc);
}

@Override
public void setFlowerLocation(MCLocation loc) {
if(loc == null) {
bh.setFlower(null);
} else {
bh.setFlower((Location) loc.getHandle());
}
}
}
@@ -0,0 +1,84 @@
package com.laytonsmith.abstraction.bukkit.entities;

import com.laytonsmith.abstraction.MCLocation;
import com.laytonsmith.abstraction.bukkit.BukkitMCLocation;
import com.laytonsmith.abstraction.entities.MCBee;
import org.bukkit.Location;
import org.bukkit.entity.Bee;
import org.bukkit.entity.Entity;

public class BukkitMCBee extends BukkitMCLivingEntity implements MCBee {

Bee b;

public BukkitMCBee(Entity e) {
super(e);
this.b = (Bee) e;
}

@Override
public MCLocation getHiveLocation() {
Location loc = b.getHive();
if(loc == null) {
return null;
}
return new BukkitMCLocation(loc);
}

@Override
public void setHiveLocation(MCLocation loc) {
if(loc == null) {
b.setHive(null);
} else {
b.setHive((Location) loc.getHandle());
}
}

@Override
public MCLocation getFlowerLocation() {
Location loc = b.getFlower();
if(loc == null) {
return null;
}
return new BukkitMCLocation(loc);
}

@Override
public void setFlowerLocation(MCLocation loc) {
if(loc == null) {
b.setFlower(null);
} else {
b.setFlower((Location) loc.getHandle());
}
}

@Override
public boolean hasNectar() {
return b.hasNectar();
}

@Override
public void setHasNectar(boolean nectar) {
b.setHasNectar(nectar);
}

@Override
public boolean hasStung() {
return b.hasStung();
}

@Override
public void setHasStung(boolean stung) {
b.setHasStung(stung);
}

@Override
public int getAnger() {
return b.getAnger();
}

@Override
public void setAnger(int ticks) {
b.setAnger(ticks);
}
}
@@ -0,0 +1,17 @@
package com.laytonsmith.abstraction.entities;

import com.laytonsmith.abstraction.MCLivingEntity;
import com.laytonsmith.abstraction.MCLocation;

public interface MCBee extends MCLivingEntity {
MCLocation getHiveLocation();
void setHiveLocation(MCLocation loc);
MCLocation getFlowerLocation();
void setFlowerLocation(MCLocation loc);
boolean hasNectar();
void setHasNectar(boolean nectar);
boolean hasStung();
void setHasStung(boolean stung);
int getAnger();
void setAnger(int ticks);
}
@@ -129,6 +129,7 @@ public boolean isProjectile() {
ARMOR_STAND,
ARROW,
BAT,
BEE(true, false, MCVersion.MC1_15),
BLAZE,
BOAT,
CAT(true, false, MCVersion.MC1_14),
@@ -10,14 +10,20 @@
ANNOUNCEADVANCEMENTS("announceAdvancements"),
COMMANDBLOCKOUTPUT("commandBlockOutput"),
DISABLEELYTRAMOVEMENTCHECK("disableElytraMovementCheck"),
DISABLERAIDS("disableRaids"),
DODAYLIGHTCYCLE("doDaylightCycle"),
DOENTITYDROPS("doEntityDrops"),
DOFIRETICK("doFireTick"),
DOIMMEDIATERESPAWN("doImmediateRespawn"),
DOINSOMNIA("doInsomnia"),
DOLIMITEDCRAFTING("doLimitedCrafting"),
DOMOBLOOT("doMobLoot"),
DOMOBSPAWNING("doMobSpawning"),
DOTILEDROPS("doTileDrops"),
DOWEATHERCYCLE("doWeatherCycle"),
DROWNINGDAMAGE("drowningDamage"),
FALLDAMAGE("fallDamage"),
FIREDAMAGE("fireDamage"),
KEEPINVENTORY("keepInventory"),
LOGADMINCOMMANDS("logAdminCommands"),
MAXCOMMANDCHAINLENGTH("maxCommandChainLength", CInt.class),
@@ -29,8 +35,7 @@
SENDCOMMANDFEEDBACK("sendCommandFeedback"),
SHOWDEATHMESSAGES("showDeathMessages"),
SPAWNRADIUS("spawnRadius", CInt.class),
SPECTATORSGENERATECHUNKS("spectatorsGenerateChunks"),
DISABLERAIDS("disableRaids");
SPECTATORSGENERATECHUNKS("spectatorsGenerateChunks");

private final String gameRule;
private final Class<? extends Mixed> ruleType;
@@ -9,6 +9,7 @@
@MEnum("com.commandhelper.Mobs")
public enum MCMobs {
BAT,
BEE,
BLAZE,
CAVESPIDER,
CHICKEN,
@@ -131,6 +131,10 @@ public String concreteName() {
FALLING_LAVA(MCVersion.MC1_14),
LANDING_LAVA(MCVersion.MC1_14),
FALLING_WATER(MCVersion.MC1_14),
DRIPPING_HONEY(MCVersion.MC1_15),
FALLING_HONEY(MCVersion.MC1_15),
FALLING_NECTAR(MCVersion.MC1_15),
LANDING_HONEY(MCVersion.MC1_15),
UNKNOWN(MCVersion.NEVER);

private final MCVersion since;
@@ -1,6 +1,7 @@
package com.laytonsmith.abstraction.enums;

import com.laytonsmith.annotations.MEnum;
import com.laytonsmith.core.Static;

@MEnum("com.commandhelper.PlayerStatistic")
public enum MCPlayerStatistic {
@@ -80,16 +81,24 @@
INTERACT_WITH_STONECUTTER,
BELL_RING,
RAID_TRIGGER,
RAID_WIN;
RAID_WIN,
INTERACT_WITH_ANVIL,
INTERACT_WITH_GRINDSTONE;

private final Type type;
private final MCVersion since;

MCPlayerStatistic() {
this.type = Type.NONE;
this(Type.NONE);
}

MCPlayerStatistic(Type type) {
this(type, MCVersion.MC1_0);
}

MCPlayerStatistic(Type type, MCVersion since) {
this.type = type;
this.since = since;
}

public Type getType() {
@@ -102,4 +111,8 @@ public Type getType() {
ITEM,
NONE
}

public boolean existsInCurrent() {
return Static.getServer().getMinecraftVersion().gte(since);
}
}
@@ -3,6 +3,7 @@
public enum MCRecipeType {
BLASTING,
CAMPFIRE,
COMPLEX,
FURNACE,
MERCHANT,
SHAPED,

0 comments on commit 7f00171

Please sign in to comment.
You can’t perform that action at this time.