Compiles again.

This commit is contained in:
Sebastian Hartte
2020-07-27 23:50:28 +02:00
parent 56ecda5173
commit 84e6aaa122
136 changed files with 1004 additions and 1108 deletions
+4 -2
View File
@@ -42,7 +42,6 @@ import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.client.model.ModelLoaderRegistry;
import net.minecraftforge.client.model.geometry.IModelGeometry;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.ModDimension;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fml.DistExecutor;
import net.minecraftforge.fml.ModLoadingContext;
@@ -102,6 +101,10 @@ public final class AppEng {
private static AppEng INSTANCE;
public static ResourceLocation makeId(String id) {
return new ResourceLocation(MOD_ID, id);
}
private final Registration registration;
public AppEng() {
@@ -129,7 +132,6 @@ public final class AppEng {
modEventBus.addGenericListener(IRecipeSerializer.class, registration::registerRecipeSerializers);
modEventBus.addGenericListener(Feature.class, registration::registerWorldGen);
modEventBus.addGenericListener(Biome.class, registration::registerBiomes);
modEventBus.addGenericListener(ModDimension.class, registration::registerModDimension);
modEventBus.addListener(Integrations::enqueueIMC);
modEventBus.addListener(this::commonSetup);
+1 -16
View File
@@ -49,7 +49,6 @@ import net.minecraftforge.client.event.ModelRegistryEvent;
import net.minecraftforge.client.event.ParticleFactoryRegisterEvent;
import net.minecraftforge.client.event.TextureStitchEvent;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.common.ModDimension;
import net.minecraftforge.common.extensions.IForgeContainerType;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.eventbus.api.IEventBus;
@@ -204,7 +203,6 @@ import appeng.recipes.handlers.InscriberRecipe;
import appeng.recipes.handlers.InscriberRecipeSerializer;
import appeng.server.AECommand;
import appeng.spatial.StorageCellBiome;
import appeng.spatial.StorageCellModDimension;
import appeng.tile.AEBaseTileEntity;
import appeng.tile.crafting.MolecularAssemblerRenderer;
import appeng.worldgen.ChargedQuartzOreConfig;
@@ -630,9 +628,6 @@ final class Registration {
* world gen
*/
for (final IWorldGen.WorldGenType type : IWorldGen.WorldGenType.values()) {
// FIXME: registries.worldgen().disableWorldGenForProviderID( type,
// StorageWorldProvider.class );
registries.worldgen().disableWorldGenForDimension(type, World.field_234919_h_.getRegistryName());
}
@@ -659,10 +654,6 @@ final class Registration {
}
b.func_235063_a_(MeteoriteStructure.INSTANCE.func_236391_a_(IFeatureConfig.NO_FEATURE_CONFIG));
b.addFeature(GenerationStage.Decoration.TOP_LAYER_MODIFICATION,
MeteoriteStructure.INSTANCE.func_236391_a_(IFeatureConfig.NO_FEATURE_CONFIG)
//.withPlacement(Placement.NOPE.configure(IPlacementConfig.NO_PLACEMENT_CONFIG))
);
}
private static void addQuartzWorldGen(Biome b) {
@@ -694,8 +685,6 @@ final class Registration {
public void registerWorldGen(RegistryEvent.Register<Feature<?>> evt) {
IForgeRegistry<Feature<?>> r = evt.getRegistry();
// r.register(MeteoriteWorldGen.INSTANCE);
r.register(MeteoriteStructure.INSTANCE);
r.register(ChargedQuartzOreFeature.INSTANCE);
}
@@ -703,10 +692,6 @@ final class Registration {
evt.getRegistry().register(StorageCellBiome.INSTANCE);
}
public void registerModDimension(RegistryEvent.Register<ModDimension> evt) {
evt.getRegistry().register(StorageCellModDimension.INSTANCE);
}
@OnlyIn(Dist.CLIENT)
public void registerTextures(TextureStitchEvent.Pre event) {
SkyChestTESR.registerTextures(event);
@@ -714,7 +699,7 @@ final class Registration {
}
public void registerCommands(final FMLServerStartingEvent evt) {
new AECommand().register(evt.getCommandDispatcher());
new AECommand().register(evt.getServer().getCommandManager().getDispatcher());
}
@OnlyIn(Dist.CLIENT)
@@ -53,12 +53,12 @@ public class ApiClientHelper implements IClientHelper {
if (cellInventory != null) {
lines.add(new StringTextComponent(cellInventory.getUsedBytes() + " ")
.appendSibling(GuiText.Of.textComponent()).appendText(" " + cellInventory.getTotalBytes() + " ")
.appendSibling(GuiText.BytesUsed.textComponent()));
.func_230529_a_(GuiText.Of.text()).func_240702_b_(" " + cellInventory.getTotalBytes() + " ")
.func_230529_a_(GuiText.BytesUsed.text()));
lines.add(new StringTextComponent(cellInventory.getStoredItemTypes() + " ")
.appendSibling(GuiText.Of.textComponent()).appendText(" " + cellInventory.getTotalItemTypes() + " ")
.appendSibling(GuiText.Types.textComponent()));
.func_230529_a_(GuiText.Of.text()).func_240702_b_(" " + cellInventory.getTotalItemTypes() + " ")
.func_230529_a_(GuiText.Types.text()));
}
if (handler.isPreformatted()) {
@@ -66,11 +66,11 @@ public class ApiClientHelper implements IClientHelper {
: GuiText.Excluded).getLocal();
if (handler.isFuzzy()) {
lines.add(GuiText.Partitioned.textComponent().appendText(" - " + list + " ")
.appendSibling(GuiText.Fuzzy.textComponent()));
lines.add(GuiText.Partitioned.withSuffix(" - " + list + " ")
.func_230529_a_(GuiText.Fuzzy.text()));
} else {
lines.add(GuiText.Partitioned.textComponent().appendText(" - " + list + " ")
.appendSibling(GuiText.Precise.textComponent()));
lines.add(GuiText.Partitioned.withSuffix(" - " + list + " ")
.func_230529_a_(GuiText.Precise.text()));
}
}
@@ -273,7 +273,7 @@ public final class ApiBlocks implements IBlocks {
}).build();
this.quartzVibrantGlass = deco
.block("quartz_vibrant_glass",
() -> new QuartzLampBlock(defaultProps(Material.GLASS).lightValue(15).notSolid()))
() -> new QuartzLampBlock(defaultProps(Material.GLASS).setLightLevel(b -> 15).notSolid()))
.addFeatures(AEFeature.DECORATIVE_LIGHTS, AEFeature.QUARTZ_GLASS)
.rendering(new BlockRenderingCustomizer() {
@Override
@@ -24,6 +24,7 @@ import java.util.List;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Hand;
import net.minecraft.util.Util;
import net.minecraft.world.IBlockReader;
import appeng.api.features.ILocatable;
@@ -77,28 +78,28 @@ public final class WirelessRegistry implements IWirelessTermRegistry {
}
if (!this.isWirelessTerminal(item)) {
player.sendMessage(PlayerMessages.DeviceNotWirelessTerminal.get());
player.sendMessage(PlayerMessages.DeviceNotWirelessTerminal.get(), Util.DUMMY_UUID);
return;
}
final IWirelessTermHandler handler = this.getWirelessTerminalHandler(item);
final String unparsedKey = handler.getEncryptionKey(item);
if (unparsedKey.isEmpty()) {
player.sendMessage(PlayerMessages.DeviceNotLinked.get());
player.sendMessage(PlayerMessages.DeviceNotLinked.get(), Util.DUMMY_UUID);
return;
}
final long parsedKey = Long.parseLong(unparsedKey);
final ILocatable securityStation = Api.instance().registries().locatable().getLocatableBy(parsedKey);
if (securityStation == null) {
player.sendMessage(PlayerMessages.StationCanNotBeLocated.get());
player.sendMessage(PlayerMessages.StationCanNotBeLocated.get(), Util.DUMMY_UUID);
return;
}
if (handler.hasPower(player, 0.5, item)) {
ContainerOpener.openContainer(WirelessTermContainer.TYPE, player, ContainerLocator.forHand(player, hand));
} else {
player.sendMessage(PlayerMessages.DeviceNotPowered.get());
player.sendMessage(PlayerMessages.DeviceNotPowered.get(), Util.DUMMY_UUID);
}
}
}
@@ -25,6 +25,7 @@ import net.minecraft.world.Dimension;
import net.minecraft.world.IWorld;
import appeng.api.features.IWorldGen;
import net.minecraft.world.server.ServerWorld;
public final class WorldGenRegistry implements IWorldGen {
@@ -40,19 +41,6 @@ public final class WorldGenRegistry implements IWorldGen {
}
}
@Override
public void disableWorldGenForProviderID(WorldGenType type, Class<? extends Dimension> provider) {
if (type == null) {
throw new IllegalArgumentException("Bad Type Passed");
}
if (provider == null) {
throw new IllegalArgumentException("Bad Provider Passed");
}
this.types[type.ordinal()].badProviders.add(provider);
}
@Override
public void enableWorldGenForDimension(final WorldGenType type, final ResourceLocation dimensionID) {
if (type == null) {
@@ -72,7 +60,7 @@ public final class WorldGenRegistry implements IWorldGen {
}
@Override
public boolean isWorldGenEnabled(final WorldGenType type, final IWorld w) {
public boolean isWorldGenEnabled(final WorldGenType type, final ServerWorld w) {
if (type == null) {
throw new IllegalArgumentException("Bad Type Passed");
}
@@ -81,12 +69,11 @@ public final class WorldGenRegistry implements IWorldGen {
throw new IllegalArgumentException("Bad Provider Passed");
}
ResourceLocation id = w.getDimension().getType().getRegistryName();
final boolean isBadProvider = this.types[type.ordinal()].badProviders.contains(w.getDimension().getClass());
ResourceLocation id = w.func_234923_W_().func_240901_a_();
final boolean isBadDimension = this.types[type.ordinal()].badDimensions.contains(id);
final boolean isGoodDimension = this.types[type.ordinal()].enabledDimensions.contains(id);
if (isBadProvider || isBadDimension) {
if (isBadDimension) {
return false;
}
@@ -99,7 +86,6 @@ public final class WorldGenRegistry implements IWorldGen {
private static class TypeSet {
final HashSet<Class<? extends Dimension>> badProviders = new HashSet<>();
final HashSet<ResourceLocation> badDimensions = new HashSet<>();
final HashSet<ResourceLocation> enabledDimensions = new HashSet<>();
}
@@ -18,6 +18,7 @@
package appeng.core.localization;
import net.minecraft.util.text.IFormattableTextComponent;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TranslationTextComponent;
@@ -70,23 +71,18 @@ public enum ButtonToolTips {
FilterMode, FilterModeKeep, FilterModeClear;
private final String root;
private final TranslationTextComponent text;
ButtonToolTips() {
this.root = "gui.tooltips.appliedenergistics2";
this.text = new TranslationTextComponent("gui.tooltips.appliedenergistics2." + this.name());
}
ButtonToolTips(final String r) {
this.root = r;
public ITextComponent text() {
return text;
}
@Deprecated
public String getLocal() {
return getTranslationKey().getFormattedText();
}
public ITextComponent getTranslationKey() {
return new TranslationTextComponent(this.root + '.' + this.toString());
public IFormattableTextComponent text(Object... args) {
return new TranslationTextComponent(text.getKey(), args);
}
}
@@ -18,6 +18,7 @@
package appeng.core.localization;
import net.minecraft.util.text.IFormattableTextComponent;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TranslationTextComponent;
@@ -85,27 +86,39 @@ public enum GuiText {
private final String root;
private final ITextComponent text;
GuiText() {
this.root = "gui.appliedenergistics2";
this.text = new TranslationTextComponent(getTranslationKey());
}
GuiText(final String r) {
this.root = r;
this.text = new TranslationTextComponent(getTranslationKey());
}
public String getLocal() {
return this.textComponent().getString();
return text.getString();
}
public String getTranslationKey() {
return this.root + '.' + this.toString();
}
public ITextComponent textComponent() {
return new TranslationTextComponent(getTranslationKey());
public ITextComponent text() {
return text;
}
public ITextComponent textComponent(Object... args) {
public IFormattableTextComponent withSuffix(String text) {
return text().deepCopy().func_240702_b_(text);
}
public IFormattableTextComponent withSuffix(ITextComponent text) {
return text().deepCopy().func_230529_a_(text);
}
public IFormattableTextComponent text(Object... args) {
return new TranslationTextComponent(getTranslationKey(), args);
}
@@ -28,11 +28,14 @@ import java.util.Set;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonObject;
import net.minecraft.advancements.ICriterionInstance;
import net.minecraft.advancements.ICriterionTrigger;
import net.minecraft.advancements.PlayerAdvancements;
import net.minecraft.advancements.criterion.CriterionInstance;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.loot.ConditionArrayParser;
import net.minecraft.loot.ConditionArraySerializer;
import net.minecraft.util.ResourceLocation;
import appeng.core.AppEng;
@@ -85,7 +88,7 @@ public class AppEngAdvancementTrigger
}
@Override
public AppEngAdvancementTrigger.Instance deserializeInstance(JsonObject json, JsonDeserializationContext context) {
public Instance func_230307_a_(JsonObject p_230307_1_, ConditionArrayParser p_230307_2_) {
return new AppEngAdvancementTrigger.Instance(this.getId());
}
@@ -98,14 +101,26 @@ public class AppEngAdvancementTrigger
}
}
public static class Instance extends CriterionInstance {
public Instance(ResourceLocation parID) {
super(parID);
public static class Instance implements ICriterionInstance {
private final ResourceLocation id;
public Instance(ResourceLocation id) {
this.id = id;
}
public boolean test() {
return true;
}
@Override
public ResourceLocation getId() {
return id;
}
@Override
public JsonObject func_230240_a_(ConditionArraySerializer p_230240_1_) {
return new JsonObject();
}
}
static class Listeners {
@@ -25,8 +25,10 @@ import net.minecraft.network.IPacket;
import net.minecraft.network.ThreadQuickExitException;
import net.minecraft.network.play.ServerPlayNetHandler;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.RegistryKey;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.DimensionType;
import net.minecraft.world.World;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.DistExecutor;
import net.minecraftforge.fml.LogicalSide;
@@ -119,15 +121,10 @@ public class NetworkHandler {
public void sendToAllAround(final BasePacket message, final TargetPoint point) {
IPacket<?> pkt = message.toPacket(NetworkDirection.PLAY_TO_CLIENT);
getServer().getPlayerList().sendToAllNearExcept(point.excluded, point.x, point.y, point.z, point.r2, point.dim,
getServer().getPlayerList().sendToAllNearExcept(point.excluded, point.x, point.y, point.z, point.r2, point.world.func_234923_W_(),
pkt);
}
public void sendToDimension(final BasePacket message, final DimensionType dim) {
getServer().getPlayerList().sendPacketToAllPlayersInDimension(message.toPacket(NetworkDirection.PLAY_TO_CLIENT),
dim);
}
public void sendToServer(final BasePacket message) {
Minecraft.getInstance().getConnection().sendPacket(message.toPacket(NetworkDirection.PLAY_TO_SERVER));
}
@@ -2,6 +2,7 @@ package appeng.core.sync.network;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.world.DimensionType;
import net.minecraft.world.World;
/**
* Created by covers1624 on 1/6/20.
@@ -13,27 +14,27 @@ public class TargetPoint {
public final double y;
public final double z;
public final double r2;
public final DimensionType dim;
public final World world;
public TargetPoint(double x, double y, double z, double r2, DimensionType dim) {
this(null, x, y, z, r2, dim);
public TargetPoint(double x, double y, double z, double r2, World world) {
this(null, x, y, z, r2, world);
}
public TargetPoint(ServerPlayerEntity excluded, double x, double y, double z, double r2, DimensionType dim) {
public TargetPoint(ServerPlayerEntity excluded, double x, double y, double z, double r2, World world) {
this.excluded = excluded;
this.x = x;
this.y = y;
this.z = z;
this.r2 = r2;
this.dim = dim;
this.world = world;
}
public static TargetPoint at(double x, double y, double z, double r2, DimensionType dim) {
return new TargetPoint(x, y, z, r2, dim);
public static TargetPoint at(double x, double y, double z, double r2, World world) {
return new TargetPoint(x, y, z, r2, world);
}
public static TargetPoint at(ServerPlayerEntity excluded, double x, double y, double z, double r2,
DimensionType dim) {
return new TargetPoint(excluded, x, y, z, r2, dim);
World world) {
return new TargetPoint(excluded, x, y, z, r2, world);
}
}
@@ -62,9 +62,9 @@ public final class WorldData implements IWorldData {
Preconditions.checkNotNull(overworld);
// Attach shared data to the server's overworld dimension
if (overworld.getDimension().getType() != DimensionType.OVERWORLD) {
if (overworld.func_234923_W_() != ServerWorld.field_234918_g_) {
throw new IllegalStateException(
"The server doesn't have an Overworld dimension we could store our data on!");
"The server doesn't have an overworld we could store our data on!");
}
final PlayerData playerData = overworld.getSavedData().getOrCreate(PlayerData::new, PlayerData.NAME);
@@ -96,7 +96,7 @@ public final class WorldData implements IWorldData {
throw new IllegalStateException("No server set.");
}
ServerWorld overworld = server.getWorld(DimensionType.OVERWORLD);
ServerWorld overworld = server.getWorld(ServerWorld.field_234918_g_);
instance = new WorldData(overworld);
}
return instance;