Merge branch 'master' into 1.15
# Conflicts: # src/main/java/carpet/script/CarpetExpression.java
This commit is contained in:
commit
e04a8be9e8
6 files changed
+45
-19
No files matched your search
@@ -43,7 +43,7 @@ public class LogCommand
|
|||||||
c.getSource(),
|
c.getSource(),
|
||||||
c.getSource().getName(),
|
c.getSource().getName(),
|
||||||
getString(c, "log name")))).
|
getString(c, "log name")))).
|
||||||
then(CommandManager.argument("option", StringArgumentType.word()).
|
then(CommandManager.argument("option", StringArgumentType.greedyString()).
|
||||||
suggests( (c, b) -> suggestMatching(
|
suggests( (c, b) -> suggestMatching(
|
||||||
(LoggerRegistry.getLogger(getString(c, "log name"))==null
|
(LoggerRegistry.getLogger(getString(c, "log name"))==null
|
||||||
?new String[]{}
|
?new String[]{}
|
||||||
|
|||||||
@@ -160,6 +160,7 @@ public class FeatureGenerator
|
|||||||
structureToFeature.put("Pillager_Outpost", Collections.singletonList("pillager_outpost"));
|
structureToFeature.put("Pillager_Outpost", Collections.singletonList("pillager_outpost"));
|
||||||
structureToFeature.put("Mineshaft", Arrays.asList("mineshaft", "mineshaft_mesa"));
|
structureToFeature.put("Mineshaft", Arrays.asList("mineshaft", "mineshaft_mesa"));
|
||||||
structureToFeature.put("Igloo", Collections.singletonList("igloo"));
|
structureToFeature.put("Igloo", Collections.singletonList("igloo"));
|
||||||
|
structureToFeature.put("Fortress", Collections.singletonList("fortress"));
|
||||||
|
|
||||||
structureToFeature.forEach((key, value) -> value.forEach(el -> featureToStructure.put(el, key)));
|
structureToFeature.forEach((key, value) -> value.forEach(el -> featureToStructure.put(el, key)));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ import net.minecraft.entity.decoration.ArmorStandEntity;
|
|||||||
import net.minecraft.entity.mob.MobEntity;
|
import net.minecraft.entity.mob.MobEntity;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.BlockItem;
|
import net.minecraft.item.BlockItem;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.Items;
|
import net.minecraft.item.Items;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
@@ -1241,16 +1242,40 @@ public class CarpetExpression
|
|||||||
long how = 0;
|
long how = 0;
|
||||||
if (lv.size() > locator.offset)
|
if (lv.size() > locator.offset)
|
||||||
how = NumericValue.asNumber(lv.get(locator.offset).evalValue(cc)).getLong();
|
how = NumericValue.asNumber(lv.get(locator.offset).evalValue(cc)).getLong();
|
||||||
|
Item item = Items.DIAMOND_PICKAXE;
|
||||||
|
if (lv.size() > locator.offset+1)
|
||||||
|
{
|
||||||
|
String itemString = lv.get(locator.offset+1).evalValue(c).getString();
|
||||||
|
item = Registry.ITEM.get(new Identifier(itemString));
|
||||||
|
if (item == Items.AIR && !itemString.equals("air")) throw new InternalExpressionException("Incorrect item: "+itemString);
|
||||||
|
}
|
||||||
|
CompoundTag tag = null;
|
||||||
|
if (lv.size() > locator.offset+2)
|
||||||
|
{
|
||||||
|
Value tagValue = lv.get(locator.offset+2).evalValue(c);
|
||||||
|
if (tagValue instanceof NBTSerializableValue)
|
||||||
|
tag = ((NBTSerializableValue) tagValue).getCompoundTag();
|
||||||
|
else
|
||||||
|
tag = NBTSerializableValue.parseString(tagValue.getString()).getCompoundTag();
|
||||||
|
}
|
||||||
world.removeBlock(where, false);
|
world.removeBlock(where, false);
|
||||||
world.playLevelEvent(null, 2001, where, Block.getRawIdFromState(state));
|
world.playLevelEvent(null, 2001, where, Block.getRawIdFromState(state));
|
||||||
|
// WIP tool still mines everything, and only enchantments count.
|
||||||
|
// need to verify the durability changes
|
||||||
|
|
||||||
if (how < 0)
|
if (how < 0)
|
||||||
{
|
{
|
||||||
Block.dropStack(world, where, new ItemStack(state.getBlock()));
|
Block.dropStack(world, where, new ItemStack(state.getBlock()));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ItemStack tool = new ItemStack(Items.DIAMOND_PICKAXE, 1);
|
ItemStack tool = new ItemStack(item, 1);
|
||||||
tool.addEnchantment(Enchantments.FORTUNE,(int)how);
|
if (tag != null)
|
||||||
|
tool.setTag(tag);
|
||||||
|
if (how > 0)
|
||||||
|
tool.addEnchantment(Enchantments.FORTUNE,(int)how);
|
||||||
|
else if (how < 0)
|
||||||
|
tool.addEnchantment(Enchantments.SILK_TOUCH, 1);
|
||||||
|
|
||||||
LootContext.Builder lootContext$Builder_1 = (new LootContext.Builder(world)).
|
LootContext.Builder lootContext$Builder_1 = (new LootContext.Builder(world)).
|
||||||
setRandom(world.random).
|
setRandom(world.random).
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package carpet.settings;
|
|||||||
import carpet.CarpetServer;
|
import carpet.CarpetServer;
|
||||||
import carpet.utils.Messenger;
|
import carpet.utils.Messenger;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.collect.Sets;
|
|
||||||
import net.minecraft.server.command.ServerCommandSource;
|
import net.minecraft.server.command.ServerCommandSource;
|
||||||
|
|
||||||
import java.lang.reflect.Constructor;
|
import java.lang.reflect.Constructor;
|
||||||
|
|||||||
@@ -82,8 +82,8 @@ public class BlockInfo
|
|||||||
put(MaterialColor.DIAMOND , "diamond" );
|
put(MaterialColor.DIAMOND , "diamond" );
|
||||||
put(MaterialColor.LAPIS , "lapis" );
|
put(MaterialColor.LAPIS , "lapis" );
|
||||||
put(MaterialColor.EMERALD , "emerald" );
|
put(MaterialColor.EMERALD , "emerald" );
|
||||||
put(MaterialColor.SPRUCE , "obsidian" );
|
put(MaterialColor.SPRUCE , "obsidian" );
|
||||||
put(MaterialColor.NETHER, "netherrack"); //TODO fix these
|
put(MaterialColor.NETHER , "netherrack"); //TODO fix these
|
||||||
put(MaterialColor.WHITE_TERRACOTTA , "white_terracotta" );
|
put(MaterialColor.WHITE_TERRACOTTA , "white_terracotta" );
|
||||||
put(MaterialColor.ORANGE_TERRACOTTA , "orange_terracotta" );
|
put(MaterialColor.ORANGE_TERRACOTTA , "orange_terracotta" );
|
||||||
put(MaterialColor.MAGENTA_TERRACOTTA , "magenta_terracotta" );
|
put(MaterialColor.MAGENTA_TERRACOTTA , "magenta_terracotta" );
|
||||||
@@ -108,8 +108,8 @@ public class BlockInfo
|
|||||||
put(Material.PORTAL , "portal" );
|
put(Material.PORTAL , "portal" );
|
||||||
put(Material.CARPET , "carpet" );
|
put(Material.CARPET , "carpet" );
|
||||||
put(Material.PLANT , "plant" );
|
put(Material.PLANT , "plant" );
|
||||||
put(Material.UNDERWATER_PLANT , "water_plant" );
|
put(Material.UNDERWATER_PLANT, "water_plant" );
|
||||||
put(Material.REPLACEABLE_PLANT , "vine" );
|
put(Material.REPLACEABLE_PLANT, "vine" );
|
||||||
put(Material.SEAGRASS , "sea_grass" );
|
put(Material.SEAGRASS , "sea_grass" );
|
||||||
put(Material.WATER , "water" );
|
put(Material.WATER , "water" );
|
||||||
put(Material.BUBBLE_COLUMN , "bubble_column");
|
put(Material.BUBBLE_COLUMN , "bubble_column");
|
||||||
@@ -117,7 +117,7 @@ public class BlockInfo
|
|||||||
put(Material.SNOW , "snow_layer" );
|
put(Material.SNOW , "snow_layer" );
|
||||||
put(Material.FIRE , "fire" );
|
put(Material.FIRE , "fire" );
|
||||||
put(Material.PART , "redstone_bits");
|
put(Material.PART , "redstone_bits");
|
||||||
put(Material.COBWEB , "cobweb" );
|
put(Material.COBWEB , "cobweb" );
|
||||||
put(Material.REDSTONE_LAMP , "redstone_lamp");
|
put(Material.REDSTONE_LAMP , "redstone_lamp");
|
||||||
put(Material.CLAY , "clay" );
|
put(Material.CLAY , "clay" );
|
||||||
put(Material.EARTH , "dirt" );
|
put(Material.EARTH , "dirt" );
|
||||||
@@ -125,9 +125,9 @@ public class BlockInfo
|
|||||||
put(Material.PACKED_ICE , "packed_ice" );
|
put(Material.PACKED_ICE , "packed_ice" );
|
||||||
put(Material.SAND , "sand" );
|
put(Material.SAND , "sand" );
|
||||||
put(Material.SPONGE , "sponge" );
|
put(Material.SPONGE , "sponge" );
|
||||||
put(Material.SHULKER_BOX , "wood" );
|
put(Material.SHULKER_BOX , "shulker" );
|
||||||
put(Material.WOOD , "wool" ); // fix these
|
put(Material.WOOD , "wood" );
|
||||||
put(Material.BAMBOO_SAPLING , "shoots" );
|
put(Material.BAMBOO_SAPLING , "shoots" );
|
||||||
put(Material.BAMBOO , "bamboo" );
|
put(Material.BAMBOO , "bamboo" );
|
||||||
put(Material.WOOL , "wool" );
|
put(Material.WOOL , "wool" );
|
||||||
put(Material.TNT , "tnt" );
|
put(Material.TNT , "tnt" );
|
||||||
@@ -136,7 +136,7 @@ public class BlockInfo
|
|||||||
put(Material.ICE , "ice" );
|
put(Material.ICE , "ice" );
|
||||||
put(Material.CACTUS , "cactus" );
|
put(Material.CACTUS , "cactus" );
|
||||||
put(Material.STONE , "stone" );
|
put(Material.STONE , "stone" );
|
||||||
put(Material.METAL , "iron" );
|
put(Material.METAL , "metal" );
|
||||||
put(Material.SNOW_BLOCK , "snow" );
|
put(Material.SNOW_BLOCK , "snow" );
|
||||||
put(Material.ANVIL , "anvil" );
|
put(Material.ANVIL , "anvil" );
|
||||||
put(Material.BARRIER , "barrier" );
|
put(Material.BARRIER , "barrier" );
|
||||||
|
|||||||
@@ -5,19 +5,17 @@ import carpet.helpers.TickSpeed;
|
|||||||
import carpet.logging.LoggerRegistry;
|
import carpet.logging.LoggerRegistry;
|
||||||
import carpet.logging.logHelpers.PacketCounter;
|
import carpet.logging.logHelpers.PacketCounter;
|
||||||
import carpet.mixins.PlayerListHeaderS2CPacketMixin;
|
import carpet.mixins.PlayerListHeaderS2CPacketMixin;
|
||||||
import net.minecraft.entity.EntityCategory;
|
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.server.network.ServerPlayerEntity;
|
import net.minecraft.server.network.ServerPlayerEntity;
|
||||||
import net.minecraft.client.network.packet.PlayerListHeaderS2CPacket;
|
import net.minecraft.client.network.packet.PlayerListHeaderS2CPacket;
|
||||||
import net.minecraft.server.MinecraftServer;
|
import net.minecraft.server.MinecraftServer;
|
||||||
import net.minecraft.util.Pair;
|
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
import net.minecraft.text.BaseText;
|
import net.minecraft.text.BaseText;
|
||||||
import net.minecraft.text.LiteralText;
|
import net.minecraft.text.LiteralText;
|
||||||
import net.minecraft.world.dimension.DimensionType;
|
import net.minecraft.world.dimension.DimensionType;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
@@ -102,9 +100,12 @@ public class HUDController
|
|||||||
|
|
||||||
private static BaseText [] send_counter_info(MinecraftServer server, String color)
|
private static BaseText [] send_counter_info(MinecraftServer server, String color)
|
||||||
{
|
{
|
||||||
HopperCounter counter = HopperCounter.getCounter(color);
|
List <BaseText> res = new ArrayList<>();
|
||||||
List <BaseText> res = counter == null ? Collections.emptyList() : counter.format(server, false, true);
|
Arrays.asList(color.split(",")).forEach(c ->{
|
||||||
return new BaseText[]{ Messenger.c(res.toArray(new Object[0]))};
|
HopperCounter counter = HopperCounter.getCounter(c);
|
||||||
|
if (counter != null) res.addAll(counter.format(server, false, true));
|
||||||
|
});
|
||||||
|
return res.toArray(new BaseText[0]);
|
||||||
}
|
}
|
||||||
private static BaseText [] packetCounter()
|
private static BaseText [] packetCounter()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in new issue
Block a user