Disable eclipse compiler and switch to SRG patches.

This commit is contained in:
LexManos 2018-09-21 20:28:47 -07:00
parent d08f8e1a78
commit 5ed03945a0
116 changed files with 1637 additions and 1591 deletions

View File

@ -56,6 +56,9 @@ project(':forge') {
apply plugin: 'eclipse'
apply plugin: 'net.minecraftforge.gradle.forgedev.patcher'
apply plugin: 'net.minecrell.licenser'
compileJava.sourceCompatibility = compileJava.targetCompatibility = sourceCompatibility = targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
sourceSets {
main {
java {
@ -75,7 +78,8 @@ project(':forge') {
patches = file("$rootDir/patches/minecraft")
patchedSrc = file('src/main/java')
accessTransformer = file("$rootDir/src/main/resources/forge_at.cfg")
srgPatches = false
exc = file("$rootDir/src/main/resources/forge.exc")
srgPatches = true
clientRun {
main = 'net.minecraftforge.fml.LaunchTesting'
environment = [
@ -121,6 +125,7 @@ project(':forge') {
ecj 'org.eclipse.jdt.core.compiler:ecj:4.6.1'
}
/* Forge compiles, no longer need eclipse compiler
compileJava {
options.fork = true
options.failOnError = false
@ -129,6 +134,7 @@ project(':forge') {
jvmArgs = ['-classpath', project.configurations.ecj.asPath, 'org.eclipse.jdt.internal.compiler.batch.Main', '-nowarn', '-proceedOnError', '-preserveAllLocals', '-parameters']
}
}
*/
task runclient(type: JavaExec, dependsOn: [":forge:downloadAssets", ":forge:extractNatives"]) {
doFirst {

View File

@ -7,16 +7,16 @@
-public class Block implements IItemProvider {
+public class Block extends net.minecraftforge.registries.ForgeRegistryEntry<Block> implements IItemProvider, net.minecraftforge.common.extensions.IForgeBlock {
protected static final Logger field_196273_d = LogManager.getLogger();
private static final ResourceLocation AIR_ID = new ResourceLocation("air");
public static final RegistryNamespacedDefaultedByKey<ResourceLocation, Block> REGISTRY = new RegistryNamespacedDefaultedByKey<ResourceLocation, Block>(AIR_ID);
private static final ResourceLocation field_176230_a = new ResourceLocation("air");
public static final RegistryNamespacedDefaultedByKey<ResourceLocation, Block> field_149771_c = new RegistryNamespacedDefaultedByKey<ResourceLocation, Block>(field_176230_a);
@@ -502,8 +502,8 @@
if (f == -1.0F) {
return 0.0F;
} else {
- int i = player.canHarvestBlock(state) ? 30 : 100;
- return player.getDigSpeed(state) / f / (float)i;
+ int i = net.minecraftforge.common.ForgeHooks.canHarvestBlock(state, player, worldIn, pos) ? 30 : 100;
+ return player.getDigSpeed(state, pos) / f / (float)i;
- int i = p_180647_2_.func_184823_b(p_180647_1_) ? 30 : 100;
- return p_180647_2_.func_184813_a(p_180647_1_) / f / (float)i;
+ int i = net.minecraftforge.common.ForgeHooks.canHarvestBlock(p_180647_1_, p_180647_2_, p_180647_3_, p_180647_4_) ? 30 : 100;
+ return p_180647_2_.getDigSpeed(p_180647_1_, p_180647_4_) / f / (float)i;
}
}
@ -25,16 +25,16 @@
}
+ @Deprecated //Use state sensitive version
protected boolean canSilkHarvest() {
return this.getDefaultState().isFullCube() && !this.hasTileEntity();
protected boolean func_149700_E() {
return this.func_176223_P().func_185917_h() && !this.func_149716_u();
}
@@ -755,6 +756,7 @@
}
}
+ @Deprecated //Forge: Use more sensitive version {@link IForgeBlockState#getSoundType(IWorldReader, BlockPos, Entity) }
public SoundType getSoundType() {
return this.blockSoundType;
public SoundType func_185467_w() {
return this.field_149762_H;
}
@@ -1604,4 +1606,56 @@
return Objects.hash(this.field_212164_a, this.field_212165_b, this.field_212166_c);
@ -45,13 +45,13 @@
+ private net.minecraftforge.common.ToolType harvestTool;
+ private int harvestLevel;
+ protected static ThreadLocal<Boolean> captureDrops = ThreadLocal.withInitial(() -> false);
+ protected static ThreadLocal<NonNullList<ItemStack>> capturedDrops = ThreadLocal.withInitial(NonNullList::create);
+ protected static ThreadLocal<NonNullList<ItemStack>> capturedDrops = ThreadLocal.withInitial(NonNullList::func_191196_a);
+ protected NonNullList<ItemStack> captureDrops(boolean start)
+ {
+ if (start) {
+ captureDrops.set(true);
+ capturedDrops.get().clear();
+ return NonNullList.create();
+ return NonNullList.func_191196_a();
+ } else {
+ captureDrops.set(false);
+ return capturedDrops.get();
@ -60,18 +60,18 @@
+
+ @Override
+ public float getSlipperiness(IBlockState state, IWorldReader world, BlockPos pos, @Nullable Entity entity) {
+ return this.slipperiness;
+ return this.field_149765_K;
+ }
+
+ @Override
+ public boolean canSilkHarvest(IBlockState state, IWorldReader world, BlockPos pos, EntityPlayer player) {
+ return this.canSilkHarvest() && !state.hasTileEntity();
+ return this.func_149700_E() && !state.hasTileEntity();
+ }
+
+ @Override
+ public void onBlockExploded(IBlockState state, World world, BlockPos pos, Explosion explosion) {
+ world.setBlockToAir(pos);
+ onExplosionDestroy(world, pos, explosion);
+ world.func_175698_g(pos);
+ func_180652_a(world, pos, explosion);
+ }
+
+ @Nullable

View File

@ -1,27 +1,27 @@
--- a/net/minecraft/client/Minecraft.java
+++ b/net/minecraft/client/Minecraft.java
@@ -405,6 +405,7 @@
this.languageManager = new LanguageManager(this.gameSettings.language);
this.resourceManager.func_199006_a(this.languageManager);
this.gameSettings.func_198017_a(this.resourcePackRepository);
+ net.minecraftforge.fml.client.ClientModLoader.begin(this, this.resourcePackRepository, this.resourceManager, this.field_195554_ax);
this.refreshResources();
this.renderEngine = new TextureManager(this.resourceManager);
this.resourceManager.func_199006_a(this.renderEngine);
this.field_135017_as = new LanguageManager(this.field_71474_y.field_74363_ab);
this.field_110451_am.func_199006_a(this.field_135017_as);
this.field_71474_y.func_198017_a(this.field_110448_aq);
+ net.minecraftforge.fml.client.ClientModLoader.begin(this, this.field_110448_aq, this.field_110451_am, this.field_195554_ax);
this.func_110436_a();
this.field_71446_o = new TextureManager(this.field_110451_am);
this.field_110451_am.func_199006_a(this.field_71446_o);
@@ -461,6 +462,7 @@
this.resourceManager.func_199006_a(this.searchTreeManager);
GlStateManager.viewport(0, 0, this.field_195558_d.func_198109_k(), this.field_195558_d.func_198091_l());
this.effectRenderer = new ParticleManager(this.world, this.renderEngine);
this.field_110451_am.func_199006_a(this.field_193995_ae);
GlStateManager.func_179083_b(0, 0, this.field_195558_d.func_198109_k(), this.field_195558_d.func_198091_l());
this.field_71452_i = new ParticleManager(this.field_71441_e, this.field_71446_o);
+ net.minecraftforge.fml.client.ClientModLoader.end();
this.ingameGUI = new GuiIngame(this);
if (this.serverName != null) {
this.displayGuiScreen(new GuiConnecting(new GuiMainMenu(), this, this.serverName, this.serverPort));
this.field_71456_v = new GuiIngame(this);
if (this.field_71475_ae != null) {
this.func_147108_a(new GuiConnecting(new GuiMainMenu(), this, this.field_71475_ae, this.field_71477_af));
@@ -470,6 +472,7 @@
this.debugRenderer = new DebugRenderer(this);
this.field_184132_p = new DebugRenderer(this);
GLFW.glfwSetErrorCallback(this::func_195545_a).free();
+ net.minecraftforge.fml.client.ClientModLoader.complete();
if (this.gameSettings.fullScreen && !this.field_195558_d.func_198113_j()) {
if (this.field_71474_y.field_74353_u && !this.field_195558_d.func_198113_j()) {
this.field_195558_d.func_198077_g();
}
@@ -485,7 +488,7 @@
@ -34,10 +34,10 @@
if (!GLFW.glfwInit()) {
throw new IllegalStateException("Failed to initialize GLFW, errors: " + Joiner.on(",").join(list));
@@ -1392,6 +1395,7 @@
NetworkManager networkmanager = NetworkManager.provideLocalClient(socketaddress);
networkmanager.setNetHandler(new NetHandlerLoginClient(networkmanager, this, (GuiScreen)null, (p_209507_0_) -> {
NetworkManager networkmanager = NetworkManager.func_150722_a(socketaddress);
networkmanager.func_150719_a(new NetHandlerLoginClient(networkmanager, this, (GuiScreen)null, (p_209507_0_) -> {
}));
+ net.minecraftforge.fml.network.NetworkHooks.registerClientLoginChannel(networkmanager);
networkmanager.sendPacket(new CPacketHandshake(socketaddress.toString(), 0, EnumConnectionState.LOGIN));
networkmanager.sendPacket(new CPacketLoginStart(this.getSession().getProfile()));
this.networkManager = networkmanager;
networkmanager.func_179290_a(new CPacketHandshake(socketaddress.toString(), 0, EnumConnectionState.LOGIN));
networkmanager.func_179290_a(new CPacketLoginStart(this.func_110432_I().func_148256_e()));
this.field_71453_ak = networkmanager;

View File

@ -2,20 +2,20 @@
+++ b/net/minecraft/client/gui/GuiBossOverlay.java
@@ -28,12 +28,17 @@
for(BossInfoClient bossinfoclient : this.mapBossInfos.values()) {
for(BossInfoClient bossinfoclient : this.field_184060_g.values()) {
int k = i / 2 - 91;
+ net.minecraftforge.client.event.RenderGameOverlayEvent.BossInfo event =
+ net.minecraftforge.client.ForgeHooksClient.bossBarRenderPre(this.client.field_195558_d, bossinfoclient, k, j, 10 + this.client.fontRenderer.FONT_HEIGHT);
+ net.minecraftforge.client.ForgeHooksClient.bossBarRenderPre(this.field_184059_f.field_195558_d, bossinfoclient, k, j, 10 + this.field_184059_f.field_71466_p.field_78288_b);
+ if (!event.isCanceled()) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.client.getTextureManager().bindTexture(GUI_BARS_TEXTURES);
this.render(k, j, bossinfoclient);
String s = bossinfoclient.getName().getFormattedText();
this.client.fontRenderer.drawStringWithShadow(s, (float)(i / 2 - this.client.fontRenderer.getStringWidth(s) / 2), (float)(j - 9), 16777215);
- j += 10 + this.client.fontRenderer.FONT_HEIGHT;
GlStateManager.func_179131_c(1.0F, 1.0F, 1.0F, 1.0F);
this.field_184059_f.func_110434_K().func_110577_a(field_184058_a);
this.func_184052_a(k, j, bossinfoclient);
String s = bossinfoclient.func_186744_e().func_150254_d();
this.field_184059_f.field_71466_p.func_175063_a(s, (float)(i / 2 - this.field_184059_f.field_71466_p.func_78256_a(s) / 2), (float)(j - 9), 16777215);
- j += 10 + this.field_184059_f.field_71466_p.field_78288_b;
+ }
+ j += event.getIncrement();
+ net.minecraftforge.client.ForgeHooksClient.bossBarRenderPost(this.client.field_195558_d);
if (j >= this.client.field_195558_d.func_198087_p() / 3) {
+ net.minecraftforge.client.ForgeHooksClient.bossBarRenderPost(this.field_184059_f.field_195558_d);
if (j >= this.field_184059_f.field_195558_d.func_198087_p() / 3) {
break;
}

View File

@ -1,22 +1,22 @@
--- a/net/minecraft/client/gui/GuiButton.java
+++ b/net/minecraft/client/gui/GuiButton.java
@@ -22,6 +22,7 @@
public boolean visible;
protected boolean hovered;
public boolean field_146125_m;
protected boolean field_146123_n;
private boolean field_194832_o;
+ public int packedFGColor; // FML
public GuiButton(int buttonId, int x, int y, String buttonText) {
this(buttonId, x, y, 200, 20, buttonText);
public GuiButton(int p_i1020_1_, int p_i1020_2_, int p_i1020_3_, String p_i1020_4_) {
this(p_i1020_1_, p_i1020_2_, p_i1020_3_, 200, 20, p_i1020_4_);
@@ -66,6 +67,11 @@
this.drawTexturedModalRect(this.x + this.width / 2, this.y, 200 - this.width / 2, 46 + i * 20, this.width / 2, this.height);
this.mouseDragged(minecraft, p_194828_1_, p_194828_2_);
this.func_73729_b(this.field_146128_h + this.field_146120_f / 2, this.field_146129_i, 200 - this.field_146120_f / 2, 46 + i * 20, this.field_146120_f / 2, this.field_146121_g);
this.func_146119_b(minecraft, p_194828_1_, p_194828_2_);
int j = 14737632;
+ if (packedFGColor != 0)
+ {
+ j = packedFGColor;
+ }
+ else
if (!this.enabled) {
if (!this.field_146124_l) {
j = 10526880;
} else if (this.hovered) {
} else if (this.field_146123_n) {

View File

@ -1,26 +1,26 @@
--- a/net/minecraft/client/gui/GuiControls.java
+++ b/net/minecraft/client/gui/GuiControls.java
@@ -36,7 +36,7 @@
this.buttonReset = this.addButton(new GuiButton(201, this.width / 2 - 155, this.height - 29, 150, 20, I18n.format("controls.resetAll")) {
this.field_146493_s = this.func_189646_b(new GuiButton(201, this.field_146294_l / 2 - 155, this.field_146295_m - 29, 150, 20, I18n.func_135052_a("controls.resetAll")) {
public void func_194829_a(double p_194829_1_, double p_194829_3_) {
for(KeyBinding keybinding : GuiControls.this.mc.gameSettings.keyBindings) {
for(KeyBinding keybinding : GuiControls.this.field_146297_k.field_71474_y.field_74324_K) {
- keybinding.func_197979_b(keybinding.func_197977_i());
+ keybinding.setToDefault();
}
KeyBinding.resetKeyBindingArrayAndHash();
KeyBinding.func_74508_b();
@@ -89,11 +89,14 @@
public boolean keyPressed(int p_keyPressed_1_, int p_keyPressed_2_, int p_keyPressed_3_) {
if (this.buttonId != null) {
if (this.field_146491_f != null) {
if (p_keyPressed_1_ == 256) {
+ this.buttonId.setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier.getActiveModifier(), InputMappings.field_197958_a);
this.options.func_198014_a(this.buttonId, InputMappings.field_197958_a);
+ this.field_146491_f.setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier.getActiveModifier(), InputMappings.field_197958_a);
this.field_146497_i.func_198014_a(this.field_146491_f, InputMappings.field_197958_a);
} else {
+ this.buttonId.setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier.getActiveModifier(), InputMappings.func_197954_a(p_keyPressed_1_, p_keyPressed_2_));
this.options.func_198014_a(this.buttonId, InputMappings.func_197954_a(p_keyPressed_1_, p_keyPressed_2_));
+ this.field_146491_f.setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier.getActiveModifier(), InputMappings.func_197954_a(p_keyPressed_1_, p_keyPressed_2_));
this.field_146497_i.func_198014_a(this.field_146491_f, InputMappings.func_197954_a(p_keyPressed_1_, p_keyPressed_2_));
}
+ if (!net.minecraftforge.client.settings.KeyModifier.isKeyCodeModifier(this.buttonId.getKey()))
this.buttonId = null;
this.time = Util.func_211177_b();
KeyBinding.resetKeyBindingArrayAndHash();
+ if (!net.minecraftforge.client.settings.KeyModifier.isKeyCodeModifier(this.field_146491_f.getKey()))
this.field_146491_f = null;
this.field_152177_g = Util.func_211177_b();
KeyBinding.func_74508_b();

View File

@ -1,16 +1,16 @@
--- a/net/minecraft/client/gui/GuiIngame.java
+++ b/net/minecraft/client/gui/GuiIngame.java
@@ -548,7 +548,13 @@
GlStateManager.pushMatrix();
GlStateManager.enableBlend();
GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
+ FontRenderer font = highlightingItemStack.getItem().getFontRenderer(highlightingItemStack);
GlStateManager.func_179094_E();
GlStateManager.func_179147_l();
GlStateManager.func_187428_a(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
+ FontRenderer font = field_92016_l.func_77973_b().getFontRenderer(field_92016_l);
+ if (font == null) {
this.getFontRenderer().drawStringWithShadow(s, (float)i, (float)j, 16777215 + (k << 24));
this.func_175179_f().func_175063_a(s, (float)i, (float)j, 16777215 + (k << 24));
+ } else {
+ i = (this.field_194811_H - font.getStringWidth(s)) / 2;
+ font.drawStringWithShadow(s, (float)i, (float)j, 16777215 + (k << 24));
+ i = (this.field_194811_H - font.func_78256_a(s)) / 2;
+ font.func_175063_a(s, (float)i, (float)j, 16777215 + (k << 24));
+ }
GlStateManager.disableBlend();
GlStateManager.popMatrix();
GlStateManager.func_179084_k();
GlStateManager.func_179121_F();
}

View File

@ -3,57 +3,57 @@
@@ -41,7 +41,7 @@
}
protected int getScrollBarX() {
- return super.getScrollBarX() + 15;
+ return super.getScrollBarX() + 35;
protected int func_148137_d() {
- return super.func_148137_d() + 15;
+ return super.func_148137_d() + 35;
}
public int getListWidth() {
public int func_148139_c() {
@@ -77,13 +77,14 @@
private KeyEntry(final KeyBinding name) {
this.keybinding = name;
this.keyDesc = I18n.format(name.getKeyDescription());
- this.btnChangeKeyBinding = new GuiButton(0, 0, 0, 75, 20, I18n.format(name.getKeyDescription())) {
+ this.btnChangeKeyBinding = new GuiButton(0, 0, 0, 95, 20, I18n.format(name.func_197978_k())) {
private KeyEntry(final KeyBinding p_i45029_2_) {
this.field_148282_b = p_i45029_2_;
this.field_148283_c = I18n.func_135052_a(p_i45029_2_.func_151464_g());
- this.field_148280_d = new GuiButton(0, 0, 0, 75, 20, I18n.func_135052_a(p_i45029_2_.func_151464_g())) {
+ this.field_148280_d = new GuiButton(0, 0, 0, 95, 20, I18n.func_135052_a(p_i45029_2_.func_197978_k())) {
public void func_194829_a(double p_194829_1_, double p_194829_3_) {
GuiKeyBindingList.this.controlsScreen.buttonId = name;
GuiKeyBindingList.this.field_148191_k.field_146491_f = p_i45029_2_;
}
};
this.btnReset = new GuiButton(0, 0, 0, 50, 20, I18n.format("controls.reset")) {
this.field_148281_e = new GuiButton(0, 0, 0, 50, 20, I18n.func_135052_a("controls.reset")) {
public void func_194829_a(double p_194829_1_, double p_194829_3_) {
+ keybinding.setToDefault();
GuiKeyBindingList.this.mc.gameSettings.func_198014_a(name, name.func_197977_i());
KeyBinding.resetKeyBindingArrayAndHash();
+ field_148282_b.setToDefault();
GuiKeyBindingList.this.field_148189_l.field_71474_y.func_198014_a(p_i45029_2_, p_i45029_2_.func_197977_i());
KeyBinding.func_74508_b();
}
@@ -95,7 +96,7 @@
int j = this.func_195002_d();
boolean flag = GuiKeyBindingList.this.controlsScreen.buttonId == this.keybinding;
GuiKeyBindingList.this.mc.fontRenderer.func_211126_b(this.keyDesc, (float)(j + 90 - GuiKeyBindingList.this.maxListLabelWidth), (float)(i + p_194999_2_ / 2 - GuiKeyBindingList.this.mc.fontRenderer.FONT_HEIGHT / 2), 16777215);
- this.btnReset.x = j + 190;
+ this.btnReset.x = j + 210;
this.btnReset.y = i;
this.btnReset.enabled = !this.keybinding.func_197985_l();
this.btnReset.func_194828_a(p_194999_3_, p_194999_4_, p_194999_6_);
boolean flag = GuiKeyBindingList.this.field_148191_k.field_146491_f == this.field_148282_b;
GuiKeyBindingList.this.field_148189_l.field_71466_p.func_211126_b(this.field_148283_c, (float)(j + 90 - GuiKeyBindingList.this.field_148188_n), (float)(i + p_194999_2_ / 2 - GuiKeyBindingList.this.field_148189_l.field_71466_p.field_78288_b / 2), 16777215);
- this.field_148281_e.field_146128_h = j + 190;
+ this.field_148281_e.field_146128_h = j + 210;
this.field_148281_e.field_146129_i = i;
this.field_148281_e.field_146124_l = !this.field_148282_b.func_197985_l();
this.field_148281_e.func_194828_a(p_194999_3_, p_194999_4_, p_194999_6_);
@@ -103,11 +104,12 @@
this.btnChangeKeyBinding.y = i;
this.btnChangeKeyBinding.displayString = this.keybinding.func_197978_k();
this.field_148280_d.field_146129_i = i;
this.field_148280_d.field_146126_j = this.field_148282_b.func_197978_k();
boolean flag1 = false;
+ boolean keyCodeModifierConflict = true; // less severe form of conflict, like SHIFT conflicting with SHIFT+G
if (!this.keybinding.func_197986_j()) {
for(KeyBinding keybinding : GuiKeyBindingList.this.mc.gameSettings.keyBindings) {
if (keybinding != this.keybinding && this.keybinding.func_197983_b(keybinding)) {
if (!this.field_148282_b.func_197986_j()) {
for(KeyBinding keybinding : GuiKeyBindingList.this.field_148189_l.field_71474_y.field_74324_K) {
if (keybinding != this.field_148282_b && this.field_148282_b.func_197983_b(keybinding)) {
flag1 = true;
- break;
+ keyCodeModifierConflict &= keybinding.hasKeyCodeModifierConflict(this.keybinding);
+ keyCodeModifierConflict &= keybinding.hasKeyCodeModifierConflict(this.field_148282_b);
}
}
}
@@ -115,7 +117,7 @@
if (flag) {
this.btnChangeKeyBinding.displayString = TextFormatting.WHITE + "> " + TextFormatting.YELLOW + this.btnChangeKeyBinding.displayString + TextFormatting.WHITE + " <";
this.field_148280_d.field_146126_j = TextFormatting.WHITE + "> " + TextFormatting.YELLOW + this.field_148280_d.field_146126_j + TextFormatting.WHITE + " <";
} else if (flag1) {
- this.btnChangeKeyBinding.displayString = TextFormatting.RED + this.btnChangeKeyBinding.displayString;
+ this.btnChangeKeyBinding.displayString = (keyCodeModifierConflict ? TextFormatting.GOLD : TextFormatting.RED) + this.btnChangeKeyBinding.displayString;
- this.field_148280_d.field_146126_j = TextFormatting.RED + this.field_148280_d.field_146126_j;
+ this.field_148280_d.field_146126_j = (keyCodeModifierConflict ? TextFormatting.GOLD : TextFormatting.RED) + this.field_148280_d.field_146126_j;
}
this.btnChangeKeyBinding.func_194828_a(p_194999_3_, p_194999_4_, p_194999_6_);
this.field_148280_d.func_194828_a(p_194999_3_, p_194999_4_, p_194999_6_);

View File

@ -1,34 +1,34 @@
--- a/net/minecraft/client/gui/GuiMainMenu.java
+++ b/net/minecraft/client/gui/GuiMainMenu.java
@@ -192,12 +192,18 @@
GuiMainMenu.this.mc.displayGuiScreen(new GuiMultiplayer(GuiMainMenu.this));
GuiMainMenu.this.field_146297_k.func_147108_a(new GuiMultiplayer(GuiMainMenu.this));
}
});
- this.addButton(new GuiButton(14, this.width / 2 - 100, p_73969_1_ + p_73969_2_ * 2, I18n.format("menu.online")) {
+ this.addButton(new GuiButton(14, this.width / 2 + 2, p_73969_1_ + p_73969_2_ * 2, 98, 20, I18n.format("menu.online")) {
- this.func_189646_b(new GuiButton(14, this.field_146294_l / 2 - 100, p_73969_1_ + p_73969_2_ * 2, I18n.func_135052_a("menu.online")) {
+ this.func_189646_b(new GuiButton(14, this.field_146294_l / 2 + 2, p_73969_1_ + p_73969_2_ * 2, 98, 20, I18n.func_135052_a("menu.online")) {
public void func_194829_a(double p_194829_1_, double p_194829_3_) {
GuiMainMenu.this.switchToRealms();
GuiMainMenu.this.func_140005_i();
}
});
+ this.addButton(new GuiButton(6, this.width / 2 - 100, p_73969_1_ + p_73969_2_ * 2, 98, 20, I18n.format("fml.menu.mods")) {
+ this.func_189646_b(new GuiButton(6, this.field_146294_l / 2 - 100, p_73969_1_ + p_73969_2_ * 2, 98, 20, I18n.func_135052_a("fml.menu.mods")) {
+ @Override
+ public void func_194829_a(double x, double y) {
+ GuiMainMenu.this.mc.displayGuiScreen(new net.minecraftforge.fml.client.gui.GuiModList(GuiMainMenu.this));
+ public void func_194829_a(double p_194829_1_, double p_194829_3_) {
+ GuiMainMenu.this.field_146297_k.func_147108_a(new net.minecraftforge.fml.client.gui.GuiModList(GuiMainMenu.this));
}
+ });
+ }
private void addDemoButtons(int p_73972_1_, int p_73972_2_) {
this.addButton(new GuiButton(11, this.width / 2 - 100, p_73972_1_, I18n.format("menu.playdemo")) {
private void func_73972_b(int p_73972_1_, int p_73972_2_) {
this.func_189646_b(new GuiButton(11, this.field_146294_l / 2 - 100, p_73972_1_, I18n.func_135052_a("menu.playdemo")) {
@@ -283,7 +289,10 @@
s = s + ("release".equalsIgnoreCase(this.mc.getVersionType()) ? "" : "/" + this.mc.getVersionType());
s = s + ("release".equalsIgnoreCase(this.field_146297_k.func_184123_d()) ? "" : "/" + this.field_146297_k.func_184123_d());
}
- this.drawString(this.fontRenderer, s, 2, this.height - 10, -1);
- this.func_73731_b(this.field_146289_q, s, 2, this.field_146295_m - 10, -1);
+ net.minecraftforge.fml.BrandingControl.forEachLine(true, true, (brdline, brd) ->
+ this.drawString(this.fontRenderer, brd, 2, this.height - ( 10 + brdline * (this.fontRenderer.FONT_HEIGHT + 1)), 16777215)
+ this.func_73731_b(this.field_146289_q, brd, 2, this.field_146295_m - ( 10 + brdline * (this.field_146289_q.field_78288_b + 1)), 16777215)
+ );
+
this.drawString(this.fontRenderer, "Copyright Mojang AB. Do not distribute!", this.widthCopyrightRest, this.height - 10, -1);
if (mouseX > this.widthCopyrightRest && mouseX < this.widthCopyrightRest + this.widthCopyright && mouseY > this.height - 10 && mouseY < this.height) {
drawRect(this.widthCopyrightRest, this.height - 1, this.widthCopyrightRest + this.widthCopyright, this.height, -1);
this.func_73731_b(this.field_146289_q, "Copyright Mojang AB. Do not distribute!", this.field_193979_N, this.field_146295_m - 10, -1);
if (p_73863_1_ > this.field_193979_N && p_73863_1_ < this.field_193979_N + this.field_193978_M && p_73863_2_ > this.field_146295_m - 10 && p_73863_2_ < this.field_146295_m) {
func_73734_a(this.field_193979_N, this.field_146295_m - 1, this.field_193979_N + this.field_193978_M, this.field_146295_m, -1);

View File

@ -1,10 +1,10 @@
--- a/net/minecraft/client/multiplayer/WorldClient.java
+++ b/net/minecraft/client/multiplayer/WorldClient.java
@@ -81,6 +81,7 @@
this.mapStorage = new SaveDataMemoryStorage();
this.calculateInitialSkylight();
this.calculateInitialWeather();
this.field_72988_C = new SaveDataMemoryStorage();
this.func_72966_v();
this.func_72947_a();
+ this.initCapabilities();
}
public void tick() {
public void func_72835_b() {

View File

@ -3,8 +3,8 @@
@@ -20,6 +20,7 @@
}
public void processHandshake(CPacketHandshake packetIn) {
+ if (!net.minecraftforge.fml.server.ServerLifecycleHooks.handleServerLogin(packetIn, this.networkManager)) return;
this.networkManager.setConnectionState(packetIn.getRequestedState());
this.networkManager.setNetHandler(new NetHandlerLoginServer(this.server, this.networkManager));
public void func_147383_a(CPacketHandshake p_147383_1_) {
+ if (!net.minecraftforge.fml.server.ServerLifecycleHooks.handleServerLogin(p_147383_1_, this.field_147384_b)) return;
this.field_147384_b.func_150723_a(p_147383_1_.func_149594_c());
this.field_147384_b.func_150719_a(new NetHandlerLoginServer(this.field_147385_a, this.field_147384_b));
}

View File

@ -4,9 +4,9 @@
}
public void func_209521_a(SPacketCustomPayloadLogin p_209521_1_) {
+ if (!net.minecraftforge.fml.network.NetworkHooks.onCustomPayload(p_209521_1_, this.networkManager)) {
+ if (!net.minecraftforge.fml.network.NetworkHooks.onCustomPayload(p_209521_1_, this.field_147393_d)) {
this.field_209525_d.accept(new TextComponentTranslation("connect.negotiating", new Object[0]));
this.networkManager.sendPacket(new CPacketCustomPayloadLogin(p_209521_1_.func_209918_a(), (PacketBuffer)null));
this.field_147393_d.func_179290_a(new CPacketCustomPayloadLogin(p_209521_1_.func_209918_a(), (PacketBuffer)null));
}
}
+}

View File

@ -1,10 +1,10 @@
--- a/net/minecraft/client/network/NetHandlerPlayClient.java
+++ b/net/minecraft/client/network/NetHandlerPlayClient.java
@@ -1598,6 +1598,7 @@
((DebugRendererWorldGenAttempts)this.client.debugRenderer.field_201750_j).func_201734_a(packetbuffer.readBlockPos(), packetbuffer.readFloat(), packetbuffer.readFloat(), packetbuffer.readFloat(), packetbuffer.readFloat(), packetbuffer.readFloat());
LOGGER.warn("Unknown custom packed identifier: {}", (Object)resourcelocation);
((DebugRendererWorldGenAttempts)this.field_147299_f.field_184132_p.field_201750_j).func_201734_a(packetbuffer.func_179259_c(), packetbuffer.readFloat(), packetbuffer.readFloat(), packetbuffer.readFloat(), packetbuffer.readFloat(), packetbuffer.readFloat());
field_147301_d.warn("Unknown custom packed identifier: {}", (Object)resourcelocation);
} else {
+ if (!net.minecraftforge.fml.network.NetworkHooks.onCustomPayload(packetIn, this.netManager))
LOGGER.warn("Unknown custom packed identifier: {}", (Object)resourcelocation);
+ if (!net.minecraftforge.fml.network.NetworkHooks.onCustomPayload(p_147240_1_, this.field_147302_e))
field_147301_d.warn("Unknown custom packed identifier: {}", (Object)resourcelocation);
}
} finally {

View File

@ -5,54 +5,54 @@
bitset.set(i1);
}
-
+ this.rawIntBuffer.limit(this.rawIntBuffer.capacity());
+ this.rawIntBuffer.position(this.getBufferSize());
+ this.field_178999_b.limit(this.field_178999_b.capacity());
+ this.field_178999_b.position(this.func_181664_j());
}
public BufferBuilder.State getVertexState() {
public BufferBuilder.State func_181672_a() {
@@ -438,15 +439,15 @@
break;
case USHORT:
case SHORT:
- this.byteBuffer.putShort(i, (short)((int)x * 32767 & '\uffff'));
- this.byteBuffer.putShort(i + 2, (short)((int)y * 32767 & '\uffff'));
- this.byteBuffer.putShort(i + 4, (short)((int)z * 32767 & '\uffff'));
+ this.byteBuffer.putShort(i, (short)((int)(x * Short.MAX_VALUE) & 0xFFFF));
+ this.byteBuffer.putShort(i + 2, (short)((int)(y * Short.MAX_VALUE) & 0xFFFF));
+ this.byteBuffer.putShort(i + 4, (short)((int)(z * Short.MAX_VALUE) & 0xFFFF));
- this.field_179001_a.putShort(i, (short)((int)p_181663_1_ * 32767 & '\uffff'));
- this.field_179001_a.putShort(i + 2, (short)((int)p_181663_2_ * 32767 & '\uffff'));
- this.field_179001_a.putShort(i + 4, (short)((int)p_181663_3_ * 32767 & '\uffff'));
+ this.field_179001_a.putShort(i, (short)((int)(p_181663_1_ * Short.MAX_VALUE) & 0xFFFF));
+ this.field_179001_a.putShort(i + 2, (short)((int)(p_181663_2_ * Short.MAX_VALUE) & 0xFFFF));
+ this.field_179001_a.putShort(i + 4, (short)((int)(p_181663_3_ * Short.MAX_VALUE) & 0xFFFF));
break;
case UBYTE:
case BYTE:
- this.byteBuffer.put(i, (byte)((int)x * 127 & 255));
- this.byteBuffer.put(i + 1, (byte)((int)y * 127 & 255));
- this.byteBuffer.put(i + 2, (byte)((int)z * 127 & 255));
+ this.byteBuffer.put(i, (byte)((int)(x * Byte.MAX_VALUE) & 0xFF));
+ this.byteBuffer.put(i + 1, (byte)((int)(y * Byte.MAX_VALUE) & 0xFF));
+ this.byteBuffer.put(i + 2, (byte)((int)(z * Byte.MAX_VALUE) & 0xFF));
- this.field_179001_a.put(i, (byte)((int)p_181663_1_ * 127 & 255));
- this.field_179001_a.put(i + 1, (byte)((int)p_181663_2_ * 127 & 255));
- this.field_179001_a.put(i + 2, (byte)((int)p_181663_3_ * 127 & 255));
+ this.field_179001_a.put(i, (byte)((int)(p_181663_1_ * Byte.MAX_VALUE) & 0xFF));
+ this.field_179001_a.put(i + 1, (byte)((int)(p_181663_2_ * Byte.MAX_VALUE) & 0xFF));
+ this.field_179001_a.put(i + 2, (byte)((int)(p_181663_3_ * Byte.MAX_VALUE) & 0xFF));
}
this.nextVertexFormatIndex();
this.func_181667_k();
@@ -521,4 +522,23 @@
return this.stateVertexFormat;
return this.field_179018_e;
}
}
+
+ //For some unknown reason Mojang changed the vanilla function to hardcode alpha as 255.... So lets re-add the parameter -.-
+ public void putColorRGBA(int index, int red, int green, int blue, int alpha) {
+ if (ByteOrder.nativeOrder() == ByteOrder.LITTLE_ENDIAN)
+ this.rawIntBuffer.put(index, alpha << 24 | blue << 16 | green << 8 | red);
+ this.field_178999_b.put(index, alpha << 24 | blue << 16 | green << 8 | red);
+ else
+ this.rawIntBuffer.put(index, red << 24 | green << 16 | blue << 8 | alpha);
+ this.field_178999_b.put(index, red << 24 | green << 16 | blue << 8 | alpha);
}
+
+ public boolean isColorDisabled() {
+ return noColor;
+ return field_78939_q;
+ }
+
+ public void putBulkData(ByteBuffer buffer) {
+ growBuffer(buffer.limit() + this.vertexFormat.getSize());
+ this.byteBuffer.position(this.vertexCount * this.vertexFormat.getSize());
+ this.byteBuffer.put(buffer);
+ this.vertexCount += buffer.limit() / this.vertexFormat.getSize();
+ func_181670_b(buffer.limit() + this.field_179011_q.func_177338_f());
+ this.field_179001_a.position(this.field_178997_d * this.field_179011_q.func_177338_f());
+ this.field_179001_a.put(buffer);
+ this.field_178997_d += buffer.limit() / this.field_179011_q.func_177338_f();
+ }
+}

View File

@ -3,9 +3,9 @@
@@ -49,7 +49,7 @@
public ItemRenderer(TextureManager p_i46552_1_, ModelManager p_i46552_2_, ItemColors p_i46552_3_) {
this.textureManager = p_i46552_1_;
- this.itemModelMesher = new ItemModelMesher(p_i46552_2_);
+ this.itemModelMesher = new net.minecraftforge.client.ItemModelMesherForge(p_i46552_2_);
this.field_175057_n = p_i46552_1_;
- this.field_175059_m = new ItemModelMesher(p_i46552_2_);
+ this.field_175059_m = new net.minecraftforge.client.ItemModelMesherForge(p_i46552_2_);
for(Item item : Item.REGISTRY) {
for(Item item : Item.field_150901_e) {
if (!field_195411_c.contains(item)) {

View File

@ -6,28 +6,28 @@
@OnlyIn(Dist.CLIENT)
-public class BakedQuad {
+public class BakedQuad implements net.minecraftforge.client.model.pipeline.IVertexProducer {
protected final int[] vertexData;
protected final int tintIndex;
protected final EnumFacing face;
protected final TextureAtlasSprite sprite;
protected final int[] field_178215_a;
protected final int field_178213_b;
protected final EnumFacing field_178214_c;
protected final TextureAtlasSprite field_187509_d;
+ /**
+ * @deprecated Use constructor with the format argument.
+ */
+ @Deprecated
public BakedQuad(int[] vertexDataIn, int tintIndexIn, EnumFacing faceIn, TextureAtlasSprite spriteIn) {
+ this(vertexDataIn, tintIndexIn, faceIn, spriteIn, true, net.minecraft.client.renderer.vertex.DefaultVertexFormats.BLOCK);
public BakedQuad(int[] p_i46574_1_, int p_i46574_2_, EnumFacing p_i46574_3_, TextureAtlasSprite p_i46574_4_) {
+ this(p_i46574_1_, p_i46574_2_, p_i46574_3_, p_i46574_4_, true, net.minecraft.client.renderer.vertex.DefaultVertexFormats.field_176600_a);
+ }
+
+ public BakedQuad(int[] vertexDataIn, int tintIndexIn, EnumFacing faceIn, TextureAtlasSprite spriteIn, boolean applyDiffuseLighting, net.minecraft.client.renderer.vertex.VertexFormat format) {
+ public BakedQuad(int[] p_i46574_1_, int p_i46574_2_, EnumFacing p_i46574_3_, TextureAtlasSprite p_i46574_4_, boolean applyDiffuseLighting, net.minecraft.client.renderer.vertex.VertexFormat format) {
+ this.format = format;
+ this.applyDiffuseLighting = applyDiffuseLighting;
this.vertexData = vertexDataIn;
this.tintIndex = tintIndexIn;
this.face = faceIn;
this.field_178215_a = p_i46574_1_;
this.field_178213_b = p_i46574_2_;
this.field_178214_c = p_i46574_3_;
@@ -38,4 +48,20 @@
public EnumFacing getFace() {
return this.face;
public EnumFacing func_178210_d() {
return this.field_178214_c;
}
+
+ protected final net.minecraft.client.renderer.vertex.VertexFormat format;

View File

@ -8,49 +8,54 @@
+ }
+
+ public BakedQuad makeBakedQuad(Vector3f p_199332_1_, Vector3f p_199332_2_, BlockPartFace p_199332_3_, TextureAtlasSprite p_199332_4_, EnumFacing p_199332_5_, net.minecraftforge.common.model.ITransformation p_199332_6_, BlockPartRotation p_199332_7_, boolean p_199332_8_, boolean p_199332_9_) {
BlockFaceUV blockfaceuv = p_199332_3_.blockFaceUV;
BlockFaceUV blockfaceuv = p_199332_3_.field_178243_e;
if (p_199332_8_) {
- blockfaceuv = this.applyUVLock(p_199332_3_.blockFaceUV, p_199332_5_, p_199332_6_);
+ blockfaceuv = net.minecraftforge.client.ForgeHooksClient.applyUVLock(p_199332_3_.blockFaceUV, p_199332_5_, p_199332_6_);
- blockfaceuv = this.func_188010_a(p_199332_3_.field_178243_e, p_199332_5_, p_199332_6_);
+ blockfaceuv = net.minecraftforge.client.ForgeHooksClient.applyUVLock(p_199332_3_.field_178243_e, p_199332_5_, p_199332_6_);
}
- int[] aint = this.makeQuadVertexData(blockfaceuv, p_199332_4_, p_199332_5_, this.func_199337_a(p_199332_1_, p_199332_2_), p_199332_6_, p_199332_7_, p_199332_9_);
- int[] aint = this.func_188012_a(blockfaceuv, p_199332_4_, p_199332_5_, this.func_199337_a(p_199332_1_, p_199332_2_), p_199332_6_, p_199332_7_, p_199332_9_);
+ int[] aint = this.makeQuadVertexData(blockfaceuv, p_199332_4_, p_199332_5_, this.func_199337_a(p_199332_1_, p_199332_2_), p_199332_6_, p_199332_7_, false);
EnumFacing enumfacing = getFacingFromVertexData(aint);
EnumFacing enumfacing = func_178410_a(aint);
if (p_199332_7_ == null) {
this.applyFacing(aint, enumfacing);
this.func_178408_a(aint, enumfacing);
}
- return new BakedQuad(aint, p_199332_3_.tintIndex, enumfacing, p_199332_4_);
- return new BakedQuad(aint, p_199332_3_.field_178245_c, enumfacing, p_199332_4_);
+ net.minecraftforge.client.ForgeHooksClient.fillNormal(aint, enumfacing);
+ return new BakedQuad(aint, p_199332_3_.tintIndex, enumfacing, p_199332_4_, p_199332_9_, net.minecraft.client.renderer.vertex.DefaultVertexFormats.BLOCK);
+ return new BakedQuad(aint, p_199332_3_.field_178245_c, enumfacing, p_199332_4_, p_199332_9_, net.minecraft.client.renderer.vertex.DefaultVertexFormats.field_176600_a);
}
private BlockFaceUV applyUVLock(BlockFaceUV p_188010_1_, EnumFacing p_188010_2_, ModelRotation p_188010_3_) {
@@ -58,6 +63,10 @@
private BlockFaceUV func_188010_a(BlockFaceUV p_188010_1_, EnumFacing p_188010_2_, ModelRotation p_188010_3_) {
@@ -58,10 +63,14 @@
}
private int[] makeQuadVertexData(BlockFaceUV uvs, TextureAtlasSprite sprite, EnumFacing orientation, float[] p_188012_4_, ModelRotation rotationIn, @Nullable BlockPartRotation partRotation, boolean shade) {
+ return makeQuadVertexData(uvs, sprite, orientation, p_188012_4_, (net.minecraftforge.common.model.ITransformation)rotationIn, partRotation, shade);
private int[] func_188012_a(BlockFaceUV p_188012_1_, TextureAtlasSprite p_188012_2_, EnumFacing p_188012_3_, float[] p_188012_4_, ModelRotation p_188012_5_, @Nullable BlockPartRotation p_188012_6_, boolean p_188012_7_) {
+ return makeQuadVertexData(p_188012_1_, p_188012_2_, p_188012_3_, p_188012_4_, (net.minecraftforge.common.model.ITransformation)p_188012_5_, p_188012_6_, p_188012_7_);
+ }
+
+ private int[] makeQuadVertexData(BlockFaceUV uvs, TextureAtlasSprite sprite, EnumFacing orientation, float[] p_188012_4_, net.minecraftforge.common.model.ITransformation rotationIn, BlockPartRotation partRotation, boolean shade) {
+ private int[] makeQuadVertexData(BlockFaceUV p_188012_1_, TextureAtlasSprite p_188012_2_, EnumFacing p_188012_3_, float[] p_188012_4_, net.minecraftforge.common.model.ITransformation p_188012_5_, BlockPartRotation p_188012_6_, boolean p_188012_7_) {
int[] aint = new int[28];
for(int i = 0; i < 4; ++i) {
- this.func_188015_a(aint, i, p_188012_3_, p_188012_1_, p_188012_4_, p_188012_2_, p_188012_5_, p_188012_6_, p_188012_7_);
+ this.fillVertexData(aint, i, p_188012_3_, p_188012_1_, p_188012_4_, p_188012_2_, p_188012_5_, p_188012_6_, p_188012_7_);
}
return aint;
@@ -102,12 +111,16 @@
}
private void fillVertexData(int[] p_188015_1_, int p_188015_2_, EnumFacing p_188015_3_, BlockFaceUV p_188015_4_, float[] p_188015_5_, TextureAtlasSprite p_188015_6_, ModelRotation p_188015_7_, @Nullable BlockPartRotation p_188015_8_, boolean p_188015_9_) {
- EnumFacing enumfacing = p_188015_7_.rotateFace(p_188015_3_);
private void func_188015_a(int[] p_188015_1_, int p_188015_2_, EnumFacing p_188015_3_, BlockFaceUV p_188015_4_, float[] p_188015_5_, TextureAtlasSprite p_188015_6_, ModelRotation p_188015_7_, @Nullable BlockPartRotation p_188015_8_, boolean p_188015_9_) {
- EnumFacing enumfacing = p_188015_7_.func_177523_a(p_188015_3_);
+ fillVertexData(p_188015_1_, p_188015_2_, p_188015_3_, p_188015_4_, p_188015_5_, p_188015_6_, (net.minecraftforge.common.model.ITransformation)p_188015_7_, p_188015_8_, p_188015_9_);
+ }
+
+ private void fillVertexData(int[] p_188015_1_, int p_188015_2_, EnumFacing p_188015_3_, BlockFaceUV p_188015_4_, float[] p_188015_5_, TextureAtlasSprite p_188015_6_, net.minecraftforge.common.model.ITransformation p_188015_7_, BlockPartRotation p_188015_8_, boolean p_188015_9_) {
+ EnumFacing enumfacing = p_188015_7_.rotate(p_188015_3_);
int i = p_188015_9_ ? this.getFaceShadeColor(enumfacing) : -1;
EnumFaceDirection.VertexInformation enumfacedirection$vertexinformation = EnumFaceDirection.getFacing(p_188015_3_).getVertexInformation(p_188015_2_);
Vector3f vector3f = new Vector3f(p_188015_5_[enumfacedirection$vertexinformation.xIndex], p_188015_5_[enumfacedirection$vertexinformation.yIndex], p_188015_5_[enumfacedirection$vertexinformation.zIndex]);
int i = p_188015_9_ ? this.func_178413_a(enumfacing) : -1;
EnumFaceDirection.VertexInformation enumfacedirection$vertexinformation = EnumFaceDirection.func_179027_a(p_188015_3_).func_179025_a(p_188015_2_);
Vector3f vector3f = new Vector3f(p_188015_5_[enumfacedirection$vertexinformation.field_179184_a], p_188015_5_[enumfacedirection$vertexinformation.field_179182_b], p_188015_5_[enumfacedirection$vertexinformation.field_179183_c]);
this.func_199336_a(vector3f, p_188015_8_);
- int j = this.func_199335_a(vector3f, p_188015_3_, p_188015_2_, p_188015_7_);
+ int j = this.rotateVertex(vector3f, p_188015_3_, p_188015_2_, p_188015_7_);
@ -61,10 +66,10 @@
p_199333_1_[i + 1] = Float.floatToRawIntBits(p_199333_4_.func_195900_b());
p_199333_1_[i + 2] = Float.floatToRawIntBits(p_199333_4_.func_195902_c());
p_199333_1_[i + 3] = p_199333_5_;
- p_199333_1_[i + 4] = Float.floatToRawIntBits(p_199333_6_.getInterpolatedU((double)p_199333_7_.getVertexU(p_199333_3_)));
- p_199333_1_[i + 4 + 1] = Float.floatToRawIntBits(p_199333_6_.getInterpolatedV((double)p_199333_7_.getVertexV(p_199333_3_)));
+ p_199333_1_[i + 4] = Float.floatToRawIntBits(p_199333_6_.getInterpolatedU((double)p_199333_7_.getVertexU(p_199333_3_) * .999 + p_199333_7_.getVertexU((p_199333_3_ + 2) % 4) * .001));
+ p_199333_1_[i + 4 + 1] = Float.floatToRawIntBits(p_199333_6_.getInterpolatedV((double)p_199333_7_.getVertexV(p_199333_3_) * .999 + p_199333_7_.getVertexV((p_199333_3_ + 2) % 4) * .001));
- p_199333_1_[i + 4] = Float.floatToRawIntBits(p_199333_6_.func_94214_a((double)p_199333_7_.func_178348_a(p_199333_3_)));
- p_199333_1_[i + 4 + 1] = Float.floatToRawIntBits(p_199333_6_.func_94207_b((double)p_199333_7_.func_178346_b(p_199333_3_)));
+ p_199333_1_[i + 4] = Float.floatToRawIntBits(p_199333_6_.func_94214_a((double)p_199333_7_.func_178348_a(p_199333_3_) * .999 + p_199333_7_.func_178348_a((p_199333_3_ + 2) % 4) * .001));
+ p_199333_1_[i + 4 + 1] = Float.floatToRawIntBits(p_199333_6_.func_94207_b((double)p_199333_7_.func_178346_b(p_199333_3_) * .999 + p_199333_7_.func_178346_b((p_199333_3_ + 2) % 4) * .001));
}
private void func_199336_a(Vector3f p_199336_1_, @Nullable BlockPartRotation p_199336_2_) {
@ -80,7 +85,7 @@
return p_199335_3_;
} else {
- this.func_199334_a(p_199335_1_, new Vector3f(0.5F, 0.5F, 0.5F), p_199335_4_.func_195820_a(), new Vector3f(1.0F, 1.0F, 1.0F));
- return p_199335_4_.rotateVertex(p_199335_2_, p_199335_3_);
- return p_199335_4_.func_177520_a(p_199335_2_, p_199335_3_);
+ net.minecraftforge.client.ForgeHooksClient.transform(p_199335_1_, p_199335_4_.getMatrix());
+ return p_199335_4_.rotate(p_199335_2_, p_199335_3_);
}

View File

@ -2,15 +2,15 @@
+++ b/net/minecraft/client/renderer/block/model/IBakedModel.java
@@ -21,7 +21,18 @@
TextureAtlasSprite getParticleTexture();
TextureAtlasSprite func_177554_e();
- ItemCameraTransforms getItemCameraTransforms();
- ItemCameraTransforms func_177552_f();
+ @Deprecated
+ default ItemCameraTransforms getItemCameraTransforms() { return ItemCameraTransforms.DEFAULT; }
+ default ItemCameraTransforms func_177552_f() { return ItemCameraTransforms.field_178357_a; }
ItemOverrideList getOverrides();
ItemOverrideList func_188617_f();
+
+ default boolean isAmbientOcclusion(IBlockState state) { return isAmbientOcclusion(); }
+ default boolean isAmbientOcclusion(IBlockState state) { return func_177555_b(); }
+
+ /*
+ * Returns the pair of the model for the given perspective, and the matrix

View File

@ -10,7 +10,7 @@
@OnlyIn(Dist.CLIENT)
-public interface IUnbakedModel {
+public interface IUnbakedModel extends IModel<IUnbakedModel> {
Collection<ResourceLocation> getOverrideLocations();
Collection<ResourceLocation> func_187965_e();
Collection<ResourceLocation> func_209559_a(Function<ResourceLocation, IUnbakedModel> p_209559_1_, Set<String> p_209559_2_);
@ -21,6 +21,6 @@
- IBakedModel func_209558_a(Function<ResourceLocation, IUnbakedModel> p_209558_1_, Function<ResourceLocation, TextureAtlasSprite> p_209558_2_, ModelRotation p_209558_3_, boolean p_209558_4_);
+ @Deprecated
+ default IBakedModel func_209558_a(Function<ResourceLocation, IUnbakedModel> p_209558_1_, Function<ResourceLocation, TextureAtlasSprite> p_209558_2_, ModelRotation p_209558_3_, boolean p_209558_4_) {
+ return bake(p_209558_1_, p_209558_2_, p_209558_3_, p_209558_4_, net.minecraft.client.renderer.vertex.DefaultVertexFormats.BLOCK);
+ return bake(p_209558_1_, p_209558_2_, p_209558_3_, p_209558_4_, net.minecraft.client.renderer.vertex.DefaultVertexFormats.field_176600_a);
}
+}

View File

@ -10,30 +10,30 @@
+@Deprecated
@OnlyIn(Dist.CLIENT)
public class ItemCameraTransforms {
public static final ItemCameraTransforms DEFAULT = new ItemCameraTransforms();
public static final ItemCameraTransforms field_178357_a = new ItemCameraTransforms();
@@ -37,6 +41,7 @@
this(ItemTransformVec3f.DEFAULT, ItemTransformVec3f.DEFAULT, ItemTransformVec3f.DEFAULT, ItemTransformVec3f.DEFAULT, ItemTransformVec3f.DEFAULT, ItemTransformVec3f.DEFAULT, ItemTransformVec3f.DEFAULT, ItemTransformVec3f.DEFAULT);
this(ItemTransformVec3f.field_178366_a, ItemTransformVec3f.field_178366_a, ItemTransformVec3f.field_178366_a, ItemTransformVec3f.field_178366_a, ItemTransformVec3f.field_178366_a, ItemTransformVec3f.field_178366_a, ItemTransformVec3f.field_178366_a, ItemTransformVec3f.field_178366_a);
}
+ @Deprecated
public ItemCameraTransforms(ItemCameraTransforms transforms) {
this.thirdperson_left = transforms.thirdperson_left;
this.thirdperson_right = transforms.thirdperson_right;
public ItemCameraTransforms(ItemCameraTransforms p_i46443_1_) {
this.field_188036_k = p_i46443_1_.field_188036_k;
this.field_188037_l = p_i46443_1_.field_188037_l;
@@ -48,6 +53,7 @@
this.fixed = transforms.fixed;
this.field_181700_p = p_i46443_1_.field_181700_p;
}
+ @Deprecated
public ItemCameraTransforms(ItemTransformVec3f thirdperson_leftIn, ItemTransformVec3f thirdperson_rightIn, ItemTransformVec3f firstperson_leftIn, ItemTransformVec3f firstperson_rightIn, ItemTransformVec3f headIn, ItemTransformVec3f guiIn, ItemTransformVec3f groundIn, ItemTransformVec3f fixedIn) {
this.thirdperson_left = thirdperson_leftIn;
this.thirdperson_right = thirdperson_rightIn;
public ItemCameraTransforms(ItemTransformVec3f p_i46569_1_, ItemTransformVec3f p_i46569_2_, ItemTransformVec3f p_i46569_3_, ItemTransformVec3f p_i46569_4_, ItemTransformVec3f p_i46569_5_, ItemTransformVec3f p_i46569_6_, ItemTransformVec3f p_i46569_7_, ItemTransformVec3f p_i46569_8_) {
this.field_188036_k = p_i46569_1_;
this.field_188037_l = p_i46569_2_;
@@ -80,6 +86,7 @@
}
}
+ @Deprecated
public ItemTransformVec3f getTransform(ItemCameraTransforms.TransformType type) {
switch(type) {
public ItemTransformVec3f func_181688_b(ItemCameraTransforms.TransformType p_181688_1_) {
switch(p_181688_1_) {
case THIRD_PERSON_LEFT_HAND:
@@ -136,7 +143,7 @@
}

View File

@ -8,7 +8,7 @@
+ // FORGE: No reason for first param to be limited to ModelBlock
+ public ItemOverrideList(IUnbakedModel p_i49525_1_, Function<ResourceLocation, IUnbakedModel> p_i49525_2_, Function<ResourceLocation, TextureAtlasSprite> p_i49525_3_, List<ItemOverride> p_i49525_4_) {
this.field_209582_c = (List)p_i49525_4_.stream().<IBakedModel>map((p_209580_3_) -> {
IUnbakedModel iunbakedmodel = p_i49525_2_.apply(p_209580_3_.getLocation());
IUnbakedModel iunbakedmodel = p_i49525_2_.apply(p_209580_3_.func_188026_a());
return Objects.equals(iunbakedmodel, p_i49525_1_) ? null : iunbakedmodel.func_209558_a(p_i49525_2_, p_i49525_3_, ModelRotation.X0_Y0, false);
@@ -56,4 +57,8 @@
@ -16,6 +16,6 @@
}
+
+ public com.google.common.collect.ImmutableList<ItemOverride> getOverrides() {
+ return com.google.common.collect.ImmutableList.copyOf(overrides);
+ return com.google.common.collect.ImmutableList.copyOf(field_188023_b);
}
+}

View File

@ -12,6 +12,6 @@
+@Deprecated
+public class ItemTransformVec3f implements net.minecraftforge.common.model.IModelState {
+ public java.util.Optional<net.minecraftforge.common.model.TRSRTransformation> apply(java.util.Optional<? extends net.minecraftforge.common.model.IModelPart> part) { return net.minecraftforge.client.ForgeHooksClient.applyTransform(this, part); }
public static final ItemTransformVec3f DEFAULT = new ItemTransformVec3f(new Vector3f(), new Vector3f(), new Vector3f(1.0F, 1.0F, 1.0F));
public final Vector3f rotation;
public final Vector3f translation;
public static final ItemTransformVec3f field_178366_a = new ItemTransformVec3f(new Vector3f(), new Vector3f(), new Vector3f(1.0F, 1.0F, 1.0F));
public final Vector3f field_178364_b;
public final Vector3f field_178365_c;

View File

@ -23,14 +23,14 @@
import org.apache.logging.log4j.Logger;
@@ -79,6 +82,9 @@
return this.parent != null;
return this.field_178315_d != null;
}
+ @Nullable
+ public ResourceLocation getParentLocation() { return parentLocation; }
+ public ResourceLocation getParentLocation() { return field_178316_e; }
+
public boolean isAmbientOcclusion() {
return this.hasParent() ? this.parent.isAmbientOcclusion() : this.ambientOcclusion;
public boolean func_178309_b() {
return this.func_178295_k() ? this.field_178315_d.func_178309_b() : this.field_178322_i;
}
@@ -178,14 +184,18 @@
return set1;
@ -48,23 +48,23 @@
- private IBakedModel func_209565_a(ModelBlock p_209565_1_, Function<ResourceLocation, IUnbakedModel> p_209565_2_, Function<ResourceLocation, TextureAtlasSprite> p_209565_3_, ModelRotation p_209565_4_, boolean p_209565_5_) {
+ private IBakedModel func_209565_a(ModelBlock p_209565_1_, Function<ResourceLocation, IUnbakedModel> p_209565_2_, Function<ResourceLocation, TextureAtlasSprite> p_209565_3_, net.minecraftforge.common.model.IModelState state, boolean uvlock) {
ModelBlock modelblock = this.getRootModel();
if (modelblock == ModelBakery.MODEL_GENERATED) {
ModelBlock modelblock = this.func_178310_f();
if (modelblock == ModelBakery.field_177606_o) {
- return field_209571_g.func_209579_a(p_209565_3_, this).func_209565_a(p_209565_1_, p_209565_2_, p_209565_3_, p_209565_4_, p_209565_5_);
+ return field_209571_g.func_209579_a(p_209565_3_, this).func_209565_a(p_209565_1_, p_209565_2_, p_209565_3_, state, uvlock);
} else if (modelblock == ModelBakery.MODEL_ENTITY) {
return new BuiltInModel(this.getAllTransforms(), this.func_209568_a(p_209565_1_, p_209565_2_, p_209565_3_));
} else if (modelblock == ModelBakery.field_177616_r) {
return new BuiltInModel(this.func_181682_g(), this.func_209568_a(p_209565_1_, p_209565_2_, p_209565_3_));
} else {
@@ -197,9 +207,10 @@
BlockPartFace blockpartface = blockpart.mapFaces.get(enumfacing);
TextureAtlasSprite textureatlassprite1 = p_209565_3_.apply(new ResourceLocation(this.resolveTextureName(blockpartface.texture)));
if (blockpartface.cullFace == null) {
- simplebakedmodel$builder.addGeneralQuad(func_209567_a(blockpart, blockpartface, textureatlassprite1, enumfacing, p_209565_4_, p_209565_5_));
+ simplebakedmodel$builder.addGeneralQuad(makeBakedQuad(blockpart, blockpartface, textureatlassprite1, enumfacing, state, uvlock));
BlockPartFace blockpartface = blockpart.field_178240_c.get(enumfacing);
TextureAtlasSprite textureatlassprite1 = p_209565_3_.apply(new ResourceLocation(this.func_178308_c(blockpartface.field_178242_d)));
if (blockpartface.field_178244_b == null) {
- simplebakedmodel$builder.func_177648_a(func_209567_a(blockpart, blockpartface, textureatlassprite1, enumfacing, p_209565_4_, p_209565_5_));
+ simplebakedmodel$builder.func_177648_a(makeBakedQuad(blockpart, blockpartface, textureatlassprite1, enumfacing, state, uvlock));
} else {
- simplebakedmodel$builder.addFaceQuad(p_209565_4_.rotateFace(blockpartface.cullFace), func_209567_a(blockpart, blockpartface, textureatlassprite1, enumfacing, p_209565_4_, p_209565_5_));
- simplebakedmodel$builder.func_177650_a(p_209565_4_.func_177523_a(blockpartface.field_178244_b), func_209567_a(blockpart, blockpartface, textureatlassprite1, enumfacing, p_209565_4_, p_209565_5_));
+
+ simplebakedmodel$builder.addFaceQuad(state.apply(Optional.empty()).map(trsr -> trsr.rotate(enumfacing)).orElse(enumfacing), makeBakedQuad(blockpart, blockpartface, textureatlassprite1, enumfacing, state, uvlock));
+ simplebakedmodel$builder.func_177650_a(state.apply(Optional.empty()).map(trsr -> trsr.rotate(enumfacing)).orElse(enumfacing), makeBakedQuad(blockpart, blockpartface, textureatlassprite1, enumfacing, state, uvlock));
}
}
}
@ -72,14 +72,14 @@
}
private static BakedQuad func_209567_a(BlockPart p_209567_0_, BlockPartFace p_209567_1_, TextureAtlasSprite p_209567_2_, EnumFacing p_209567_3_, ModelRotation p_209567_4_, boolean p_209567_5_) {
- return field_209572_h.func_199332_a(p_209567_0_.positionFrom, p_209567_0_.positionTo, p_209567_1_, p_209567_2_, p_209567_3_, p_209567_4_, p_209567_0_.partRotation, p_209567_5_, p_209567_0_.shade);
- return field_209572_h.func_199332_a(p_209567_0_.field_178241_a, p_209567_0_.field_178239_b, p_209567_1_, p_209567_2_, p_209567_3_, p_209567_4_, p_209567_0_.field_178237_d, p_209567_5_, p_209567_0_.field_178238_e);
+ return makeBakedQuad(p_209567_0_, p_209567_1_, p_209567_2_, p_209567_3_, (net.minecraftforge.common.model.IModelState) p_209567_4_, p_209567_5_);
}
+ public static BakedQuad makeBakedQuad(BlockPart p_209567_0_, BlockPartFace p_209567_1_, TextureAtlasSprite p_209567_2_, EnumFacing p_209567_3_, net.minecraftforge.common.model.IModelState p_209567_4_, boolean p_209567_5_) {
+ return field_209572_h.makeBakedQuad(p_209567_0_.positionFrom, p_209567_0_.positionTo, p_209567_1_, p_209567_2_, p_209567_3_, p_209567_4_.apply(Optional.empty()).orElse(net.minecraftforge.common.model.TRSRTransformation.identity()), p_209567_0_.partRotation, p_209567_5_, p_209567_0_.shade);
+ return field_209572_h.makeBakedQuad(p_209567_0_.field_178241_a, p_209567_0_.field_178239_b, p_209567_1_, p_209567_2_, p_209567_3_, p_209567_4_.apply(Optional.empty()).orElse(net.minecraftforge.common.model.TRSRTransformation.identity()), p_209567_0_.field_178237_d, p_209567_5_, p_209567_0_.field_178238_e);
+ }
+
public boolean isTexturePresent(String textureName) {
return !MissingTextureSprite.func_195677_a().func_195668_m().toString().equals(this.resolveTextureName(textureName));
public boolean func_178300_b(String p_178300_1_) {
return !MissingTextureSprite.func_195677_a().func_195668_m().toString().equals(this.func_178308_c(p_178300_1_));
}

View File

@ -13,12 +13,12 @@
X0_Y90(0, 90),
X0_Y180(0, 180),
@@ -97,4 +98,9 @@
public static ModelRotation getModelRotation(int x, int y) {
return MAP_ROTATIONS.get(combineXY(MathHelper.normalizeAngle(x, 360), MathHelper.normalizeAngle(y, 360)));
public static ModelRotation func_177524_a(int p_177524_0_, int p_177524_1_) {
return field_177546_q.get(func_177521_b(MathHelper.func_180184_b(p_177524_0_, 360), MathHelper.func_180184_b(p_177524_1_, 360)));
}
+
+ public java.util.Optional<net.minecraftforge.common.model.TRSRTransformation> apply(java.util.Optional<? extends net.minecraftforge.common.model.IModelPart> part) { return net.minecraftforge.client.ForgeHooksClient.applyTransform(this, part); }
+ public javax.vecmath.Matrix4f getMatrix() { return net.minecraftforge.common.model.TRSRTransformation.from(this).getMatrix(); }
+ public EnumFacing rotate(EnumFacing facing) { return rotateFace(facing); }
+ public int rotate(EnumFacing facing, int vertexIndex) { return rotateVertex(facing, vertexIndex); }
+ public EnumFacing rotate(EnumFacing facing) { return func_177523_a(facing); }
+ public int rotate(EnumFacing facing, int vertexIndex) { return func_177520_a(facing, vertexIndex); }
}

View File

@ -6,22 +6,22 @@
@OnlyIn(Dist.CLIENT)
-public class Variant {
+public class Variant implements net.minecraftforge.client.model.ISmartVariant {
private final ResourceLocation modelLocation;
private final ModelRotation rotation;
private final boolean uvLock;
private final ResourceLocation field_188050_a;
private final ModelRotation field_188051_b;
private final boolean field_188052_c;
@@ -29,10 +29,15 @@
return this.modelLocation;
return this.field_188050_a;
}
+ @Deprecated
public ModelRotation getRotation() {
return this.rotation;
public ModelRotation func_188048_b() {
return this.field_188051_b;
}
+ public net.minecraftforge.common.model.IModelState getState() {
+ return this.rotation;
+ return this.field_188051_b;
+ }
+
public boolean isUvLock() {
return this.uvLock;
public boolean func_188049_c() {
return this.field_188052_c;
}

View File

@ -7,14 +7,14 @@
- public IBakedModel func_209558_a(Function<ResourceLocation, IUnbakedModel> p_209558_1_, Function<ResourceLocation, TextureAtlasSprite> p_209558_2_, ModelRotation p_209558_3_, boolean p_209558_4_) {
+ @Override
+ public IBakedModel bake(Function<ResourceLocation, IUnbakedModel> p_209558_1_, Function<ResourceLocation, TextureAtlasSprite> p_209558_2_, net.minecraftforge.common.model.IModelState p_209558_3_, boolean p_209558_4_, net.minecraft.client.renderer.vertex.VertexFormat format) {
if (this.getVariantList().isEmpty()) {
if (this.func_188114_a().isEmpty()) {
return null;
} else {
WeightedBakedModel.Builder weightedbakedmodel$builder = new WeightedBakedModel.Builder();
for(Variant variant : this.getVariantList()) {
- IBakedModel ibakedmodel = (p_209558_1_.apply(variant.getModelLocation())).func_209558_a(p_209558_1_, p_209558_2_, variant.getRotation(), variant.isUvLock());
+ IBakedModel ibakedmodel = (p_209558_1_.apply(variant.getModelLocation())).bake(p_209558_1_, p_209558_2_, variant.getState(), variant.isUvLock(), format);
weightedbakedmodel$builder.add(ibakedmodel, variant.getWeight());
for(Variant variant : this.func_188114_a()) {
- IBakedModel ibakedmodel = (p_209558_1_.apply(variant.func_188046_a())).func_209558_a(p_209558_1_, p_209558_2_, variant.func_188048_b(), variant.func_188049_c());
+ IBakedModel ibakedmodel = (p_209558_1_.apply(variant.func_188046_a())).bake(p_209558_1_, p_209558_2_, variant.getState(), variant.func_188049_c(), format);
weightedbakedmodel$builder.func_177677_a(ibakedmodel, variant.func_188047_d());
}

View File

@ -9,9 +9,9 @@
+ public IBakedModel bake(Function<ResourceLocation, IUnbakedModel> p_209558_1_, Function<ResourceLocation, TextureAtlasSprite> p_209558_2_, net.minecraftforge.common.model.IModelState p_209558_3_, boolean p_209558_4_, net.minecraft.client.renderer.vertex.VertexFormat format) {
MultipartBakedModel.Builder multipartbakedmodel$builder = new MultipartBakedModel.Builder();
for(Selector selector : this.getSelectors()) {
- IBakedModel ibakedmodel = selector.getVariantList().func_209558_a(p_209558_1_, p_209558_2_, p_209558_3_, p_209558_4_);
+ IBakedModel ibakedmodel = selector.getVariantList().bake(p_209558_1_, p_209558_2_, p_209558_3_, p_209558_4_, format);
for(Selector selector : this.func_188136_a()) {
- IBakedModel ibakedmodel = selector.func_188165_a().func_209558_a(p_209558_1_, p_209558_2_, p_209558_3_, p_209558_4_);
+ IBakedModel ibakedmodel = selector.func_188165_a().bake(p_209558_1_, p_209558_2_, p_209558_3_, p_209558_4_, format);
if (ibakedmodel != null) {
multipartbakedmodel$builder.putModel(selector.getPredicate(this.stateContainer), ibakedmodel);
multipartbakedmodel$builder.func_188648_a(selector.func_188166_a(this.field_188140_b), ibakedmodel);
}

View File

@ -8,6 +8,6 @@
+ // Forge Start
+
+ public int getPixelRGBA(int frameIndex, int x, int y) {
+ return this.field_195670_c[frameIndex].func_195709_a(x + this.field_195671_d[frameIndex] * this.width, y + this.field_195672_e[frameIndex] * this.height);
+ return this.field_195670_c[frameIndex].func_195709_a(x + this.field_195671_d[frameIndex] * this.field_130223_c, y + this.field_195672_e[frameIndex] * this.field_130224_d);
}
+}

View File

@ -6,6 +6,6 @@
+ public void renderTileEntityFast(T te, double x, double y, double z, float partialTicks, int destroyStage, net.minecraft.client.renderer.BufferBuilder buffer) {}
+
protected void drawNameplate(T te, String str, double x, double y, double z, int maxDistance) {
Entity entity = this.rendererDispatcher.entity;
double d0 = te.getDistanceSq(entity.posX, entity.posY, entity.posZ);
protected void func_190052_a(T p_190052_1_, String p_190052_2_, double p_190052_3_, double p_190052_5_, double p_190052_7_, int p_190052_9_) {
Entity entity = this.field_147501_a.field_147551_g;
double d0 = p_190052_1_.func_145835_a(entity.field_70165_t, entity.field_70163_u, entity.field_70161_v);

View File

@ -16,6 +16,6 @@
+ public void preDraw(VertexFormat format, int element, int stride, java.nio.ByteBuffer buffer) { net.minecraftforge.client.ForgeHooksClient.preDraw(this, format, element, stride, buffer); }
+ public void postDraw(VertexFormat format, int element, int stride, java.nio.ByteBuffer buffer) { net.minecraftforge.client.ForgeHooksClient.postDraw(this, format, element, stride, buffer); }
+
private final String displayName;
private final String field_177392_h;
private EnumUsage(String displayNameIn) {
private EnumUsage(String p_i46094_3_) {

View File

@ -2,9 +2,9 @@
+++ b/net/minecraft/client/resources/I18n.java
@@ -9,6 +9,7 @@
static void setLocale(Locale i18nLocaleIn) {
i18nLocale = i18nLocaleIn;
+ net.minecraftforge.fml.ForgeI18n.loadLanguageData(i18nLocale.properties);
static void func_135051_a(Locale p_135051_0_) {
field_135054_a = p_135051_0_;
+ net.minecraftforge.fml.ForgeI18n.loadLanguageData(field_135054_a.field_135032_a);
}
public static String format(String translateKey, Object... parameters) {
public static String func_135052_a(String p_135052_0_, Object... p_135052_1_) {

View File

@ -1,22 +1,22 @@
--- a/net/minecraft/client/resources/Language.java
+++ b/net/minecraft/client/resources/Language.java
@@ -15,7 +15,13 @@
this.region = regionIn;
this.name = nameIn;
this.bidirectional = bidirectionalIn;
+ String[] splitLangCode = name.split("_", 2);
this.field_135037_b = p_i1303_2_;
this.field_135038_c = p_i1303_3_;
this.field_135036_d = p_i1303_4_;
+ String[] splitLangCode = field_135038_c.split("_", 2);
+ if (splitLangCode.length == 1) { // Vanilla has some languages without underscores
+ this.javaLocale = new java.util.Locale(languageCode);
+ this.javaLocale = new java.util.Locale(field_135039_a);
+ } else {
+ this.javaLocale = new java.util.Locale(splitLangCode[0], splitLangCode[1]);
}
+ }
public String getLanguageCode() {
return this.languageCode;
public String func_135034_a() {
return this.field_135039_a;
@@ -44,4 +50,8 @@
public int compareTo(Language p_compareTo_1_) {
return this.languageCode.compareTo(p_compareTo_1_.languageCode);
return this.field_135039_a.compareTo(p_compareTo_1_.field_135039_a);
}
+
+ // Forge: add access to Locale so modders can create correct string and number formatters

View File

@ -6,76 +6,76 @@
@OnlyIn(Dist.CLIENT)
-public class KeyBinding implements Comparable<KeyBinding> {
+public class KeyBinding implements Comparable<KeyBinding>, net.minecraftforge.client.extensions.IForgeKeybinding {
private static final Map<String, KeyBinding> KEYBIND_ARRAY = Maps.<String, KeyBinding>newHashMap();
- private static final Map<InputMappings.Input, KeyBinding> HASH = Maps.<InputMappings.Input, KeyBinding>newHashMap();
+ private static final net.minecraftforge.client.settings.KeyBindingMap HASH = new net.minecraftforge.client.settings.KeyBindingMap();
private static final Set<String> KEYBIND_SET = Sets.<String>newHashSet();
private static final Map<String, Integer> CATEGORY_ORDER = (Map)Util.func_200696_a(Maps.newHashMap(), (p_205215_0_) -> {
private static final Map<String, KeyBinding> field_74516_a = Maps.<String, KeyBinding>newHashMap();
- private static final Map<InputMappings.Input, KeyBinding> field_74514_b = Maps.<InputMappings.Input, KeyBinding>newHashMap();
+ private static final net.minecraftforge.client.settings.KeyBindingMap field_74514_b = new net.minecraftforge.client.settings.KeyBindingMap();
private static final Set<String> field_151473_c = Sets.<String>newHashSet();
private static final Map<String, Integer> field_193627_d = (Map)Util.func_200696_a(Maps.newHashMap(), (p_205215_0_) -> {
p_205215_0_.put("key.categories.movement", 1);
@@ -33,7 +33,7 @@
private int pressTime;
private int field_151474_i;
public static void func_197981_a(InputMappings.Input p_197981_0_) {
- KeyBinding keybinding = HASH.get(p_197981_0_);
+ for (KeyBinding keybinding : HASH.lookupAll(p_197981_0_))
- KeyBinding keybinding = field_74514_b.get(p_197981_0_);
+ for (KeyBinding keybinding : field_74514_b.lookupAll(p_197981_0_))
if (keybinding != null) {
++keybinding.pressTime;
++keybinding.field_151474_i;
}
@@ -41,7 +41,7 @@
}
public static void func_197980_a(InputMappings.Input p_197980_0_, boolean p_197980_1_) {
- KeyBinding keybinding = HASH.get(p_197980_0_);
+ for (KeyBinding keybinding : HASH.lookupAll(p_197980_0_))
- KeyBinding keybinding = field_74514_b.get(p_197980_0_);
+ for (KeyBinding keybinding : field_74514_b.lookupAll(p_197980_0_))
if (keybinding != null) {
keybinding.pressed = p_197980_1_;
keybinding.field_74513_e = p_197980_1_;
}
@@ -65,10 +65,10 @@
}
public static void resetKeyBindingArrayAndHash() {
- HASH.clear();
+ HASH.clearMap();
public static void func_74508_b() {
- field_74514_b.clear();
+ field_74514_b.clearMap();
for(KeyBinding keybinding : KEYBIND_ARRAY.values()) {
- HASH.put(keybinding.keyCode, keybinding);
+ HASH.addKey(keybinding.keyCode, keybinding);
for(KeyBinding keybinding : field_74516_a.values()) {
- field_74514_b.put(keybinding.field_74512_d, keybinding);
+ field_74514_b.addKey(keybinding.field_74512_d, keybinding);
}
}
@@ -83,12 +83,12 @@
this.keyCodeDefault = this.keyCode;
this.keyCategory = p_i47675_4_;
KEYBIND_ARRAY.put(p_i47675_1_, this);
- HASH.put(this.keyCode, this);
+ HASH.addKey(this.keyCode, this);
KEYBIND_SET.add(p_i47675_4_);
this.field_151472_e = this.field_74512_d;
this.field_151471_f = p_i47675_4_;
field_74516_a.put(p_i47675_1_, this);
- field_74514_b.put(this.field_74512_d, this);
+ field_74514_b.addKey(this.field_74512_d, this);
field_151473_c.add(p_i47675_4_);
}
public boolean isKeyDown() {
- return this.pressed;
+ return this.pressed && getKeyConflictContext().isActive() && getKeyModifier().isActive(getKeyConflictContext());
public boolean func_151470_d() {
- return this.field_74513_e;
+ return this.field_74513_e && getKeyConflictContext().isActive() && getKeyModifier().isActive(getKeyConflictContext());
}
public String getKeyCategory() {
public String func_151466_e() {
@@ -122,17 +122,41 @@
}
public int compareTo(KeyBinding p_compareTo_1_) {
- return this.keyCategory.equals(p_compareTo_1_.keyCategory) ? I18n.format(this.keyDescription).compareTo(I18n.format(p_compareTo_1_.keyDescription)) : ((Integer)CATEGORY_ORDER.get(this.keyCategory)).compareTo(CATEGORY_ORDER.get(p_compareTo_1_.keyCategory));
+ if (this.keyCategory.equals(p_compareTo_1_.keyCategory)) return I18n.format(this.keyDescription).compareTo(I18n.format(p_compareTo_1_.keyDescription));
+ Integer tCat = CATEGORY_ORDER.get(this.keyCategory);
+ Integer oCat = CATEGORY_ORDER.get(p_compareTo_1_.keyCategory);
- return this.field_151471_f.equals(p_compareTo_1_.field_151471_f) ? I18n.func_135052_a(this.field_74515_c).compareTo(I18n.func_135052_a(p_compareTo_1_.field_74515_c)) : ((Integer)field_193627_d.get(this.field_151471_f)).compareTo(field_193627_d.get(p_compareTo_1_.field_151471_f));
+ if (this.field_151471_f.equals(p_compareTo_1_.field_151471_f)) return I18n.func_135052_a(this.field_74515_c).compareTo(I18n.func_135052_a(p_compareTo_1_.field_74515_c));
+ Integer tCat = field_193627_d.get(this.field_151471_f);
+ Integer oCat = field_193627_d.get(p_compareTo_1_.field_151471_f);
+ if (tCat == null && oCat != null) return 1;
+ if (tCat != null && oCat == null) return -1;
+ if (tCat == null && oCat == null) return I18n.format(this.keyCategory).compareTo(I18n.format(p_compareTo_1_.keyCategory));
+ if (tCat == null && oCat == null) return I18n.func_135052_a(this.field_151471_f).compareTo(I18n.func_135052_a(p_compareTo_1_.field_151471_f));
+ return tCat.compareTo(oCat);
}
public static Supplier<String> getDisplayString(String key) {
KeyBinding keybinding = KEYBIND_ARRAY.get(key);
public static Supplier<String> func_193626_b(String p_193626_0_) {
KeyBinding keybinding = field_74516_a.get(p_193626_0_);
return keybinding == null ? () -> {
return key;
return p_193626_0_;
- } : keybinding::func_197978_k;
+ } : () -> keybinding.func_197978_k();
}
@ -99,24 +99,24 @@
+ (keyModifier == net.minecraftforge.client.settings.KeyModifier.NONE || otherKeyModifier == net.minecraftforge.client.settings.KeyModifier.NONE));
+ }
+ }
return this.keyCode.equals(p_197983_1_.keyCode);
return this.field_74512_d.equals(p_197983_1_.field_74512_d);
}
@@ -153,14 +177,94 @@
}
public String func_197978_k() {
- return this.keyCode.func_197936_a();
+ return getKeyModifier().getLocalizedComboName(this.keyCode);
- return this.field_74512_d.func_197936_a();
+ return getKeyModifier().getLocalizedComboName(this.field_74512_d);
}
public boolean func_197985_l() {
- return this.keyCode.equals(this.keyCodeDefault);
+ return getKey().equals(this.keyCodeDefault) && getKeyModifier() == getKeyModifierDefault();
- return this.field_74512_d.equals(this.field_151472_e);
+ return getKey().equals(this.field_151472_e) && getKeyModifier() == getKeyModifierDefault();
}
public String func_197982_m() {
return this.keyCode.func_197935_d();
return this.field_74512_d.func_197935_d();
}
+
+ /****************** Forge Start *****************************/
@ -138,10 +138,10 @@
+ */
+ public KeyBinding(String description, net.minecraftforge.client.settings.IKeyConflictContext keyConflictContext, net.minecraftforge.client.settings.KeyModifier keyModifier, InputMappings.Input keyCode, String category)
+ {
+ this.keyDescription = description;
+ this.keyCode = keyCode;
+ this.keyCodeDefault = keyCode;
+ this.keyCategory = category;
+ this.field_74515_c = description;
+ this.field_74512_d = keyCode;
+ this.field_151472_e = keyCode;
+ this.field_151471_f = category;
+ this.keyConflictContext = keyConflictContext;
+ this.keyModifier = keyModifier;
+ this.keyModifierDefault = keyModifier;
@ -149,15 +149,15 @@
+ {
+ this.keyModifier = net.minecraftforge.client.settings.KeyModifier.NONE;
+ }
+ KEYBIND_ARRAY.put(description, this);
+ HASH.addKey(keyCode, this);
+ KEYBIND_SET.add(category);
+ field_74516_a.put(description, this);
+ field_74514_b.addKey(keyCode, this);
+ field_151473_c.add(category);
+ }
+
+ @Override
+ public InputMappings.Input getKey()
+ {
+ return this.keyCode;
+ return this.field_74512_d;
+ }
+
+ @Override
@ -187,14 +187,14 @@
+ @Override
+ public void setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier keyModifier, InputMappings.Input keyCode)
+ {
+ this.keyCode = keyCode;
+ this.field_74512_d = keyCode;
+ if (keyModifier.matches(keyCode))
+ {
+ keyModifier = net.minecraftforge.client.settings.KeyModifier.NONE;
+ }
+ HASH.removeKey(this);
+ field_74514_b.removeKey(this);
+ this.keyModifier = keyModifier;
+ HASH.addKey(keyCode, this);
+ field_74514_b.addKey(keyCode, this);
+ }
+
+ /****************** Forge End *****************************/

View File

@ -6,6 +6,6 @@
-public abstract class Enchantment {
+public abstract class Enchantment extends net.minecraftforge.registries.ForgeRegistryEntry<Enchantment> {
public static final RegistryNamespaced<ResourceLocation, Enchantment> REGISTRY = new RegistryNamespaced<ResourceLocation, Enchantment>();
private final EntityEquipmentSlot[] applicableEquipmentTypes;
private final Enchantment.Rarity rarity;
public static final RegistryNamespaced<ResourceLocation, Enchantment> field_185264_b = new RegistryNamespaced<ResourceLocation, Enchantment>();
private final EntityEquipmentSlot[] field_185263_a;
private final Enchantment.Rarity field_77333_a;

View File

@ -6,22 +6,22 @@
-public abstract class Entity implements INameable, ICommandSource {
+public abstract class Entity extends net.minecraftforge.common.capabilities.CapabilityProvider implements INameable, ICommandSource, net.minecraftforge.common.extensions.IForgeEntity {
protected static final Logger LOGGER = LogManager.getLogger();
private static final List<ItemStack> EMPTY_EQUIPMENT = Collections.<ItemStack>emptyList();
private static final AxisAlignedBB ZERO_AABB = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D);
protected static final Logger field_184243_a = LogManager.getLogger();
private static final List<ItemStack> field_190535_b = Collections.<ItemStack>emptyList();
private static final AxisAlignedBB field_174836_a = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D);
@@ -210,7 +210,7 @@
this.world = p_i48580_2_;
this.setPosition(0.0D, 0.0D, 0.0D);
this.field_70170_p = p_i48580_2_;
this.func_70107_b(0.0D, 0.0D, 0.0D);
if (p_i48580_2_ != null) {
- this.dimension = p_i48580_2_.provider.getDimensionType().getId();
+ this.dimension = p_i48580_2_.provider.getId();
- this.field_71093_bK = p_i48580_2_.field_73011_w.func_186058_p().func_186068_a();
+ this.field_71093_bK = p_i48580_2_.field_73011_w.getId();
}
this.dataManager = new EntityDataManager(this);
this.field_70180_af = new EntityDataManager(this);
@@ -221,6 +221,8 @@
this.dataManager.register(SILENT, false);
this.dataManager.register(NO_GRAVITY, false);
this.entityInit();
this.field_70180_af.func_187214_a(field_184234_aB, false);
this.field_70180_af.func_187214_a(field_189655_aD, false);
this.func_70088_a();
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityEvent.EntityConstructing(this));
+ this.gatherCapabilities();
}
@ -29,143 +29,143 @@
public EntityType<?> func_200600_R() {
@@ -845,7 +847,7 @@
protected void playStepSound(BlockPos pos, IBlockState blockIn) {
if (!blockIn.getMaterial().isLiquid()) {
- SoundType soundtype = this.world.getBlockState(pos.up()).getBlock() == Blocks.SNOW ? Blocks.SNOW.getSoundType() : blockIn.getBlock().getSoundType();
+ SoundType soundtype = this.world.getBlockState(pos.up()).getBlock() == Blocks.SNOW ? Blocks.SNOW.getSoundType() : blockIn.getSoundType(world, pos, this);
this.playSound(soundtype.getStepSound(), soundtype.getVolume() * 0.15F, soundtype.getPitch());
protected void func_180429_a(BlockPos p_180429_1_, IBlockState p_180429_2_) {
if (!p_180429_2_.func_185904_a().func_76224_d()) {
- SoundType soundtype = this.field_70170_p.func_180495_p(p_180429_1_.func_177984_a()).func_177230_c() == Blocks.field_150433_aE ? Blocks.field_150433_aE.func_185467_w() : p_180429_2_.func_177230_c().func_185467_w();
+ SoundType soundtype = this.field_70170_p.func_180495_p(p_180429_1_.func_177984_a()).func_177230_c() == Blocks.field_150433_aE ? Blocks.field_150433_aE.func_185467_w() : p_180429_2_.getSoundType(field_70170_p, p_180429_1_, this);
this.func_184185_a(soundtype.func_185844_d(), soundtype.func_185843_a() * 0.15F, soundtype.func_185847_b());
}
}
@@ -1040,6 +1042,7 @@
int k = MathHelper.floor(this.posZ);
int k = MathHelper.func_76128_c(this.field_70161_v);
BlockPos blockpos = new BlockPos(i, j, k);
IBlockState iblockstate = this.world.getBlockState(blockpos);
+ if (!iblockstate.addRunningEffects(world, blockpos, this))
if (iblockstate.getRenderType() != EnumBlockRenderType.INVISIBLE) {
this.world.func_195594_a(new BlockParticleData(Particles.field_197611_d, iblockstate), this.posX + ((double)this.rand.nextFloat() - 0.5D) * (double)this.width, this.getEntityBoundingBox().minY + 0.1D, this.posZ + ((double)this.rand.nextFloat() - 0.5D) * (double)this.width, -this.motionX * 4.0D, 1.5D, -this.motionZ * 4.0D);
IBlockState iblockstate = this.field_70170_p.func_180495_p(blockpos);
+ if (!iblockstate.addRunningEffects(field_70170_p, blockpos, this))
if (iblockstate.func_185901_i() != EnumBlockRenderType.INVISIBLE) {
this.field_70170_p.func_195594_a(new BlockParticleData(Particles.field_197611_d, iblockstate), this.field_70165_t + ((double)this.field_70146_Z.nextFloat() - 0.5D) * (double)this.field_70130_N, this.func_174813_aQ().field_72338_b + 0.1D, this.field_70161_v + ((double)this.field_70146_Z.nextFloat() - 0.5D) * (double)this.field_70130_N, -this.field_70159_w * 4.0D, 1.5D, -this.field_70179_y * 4.0D);
}
@@ -1053,7 +1056,7 @@
double d0 = this.posY + (double)this.getEyeHeight();
BlockPos blockpos = new BlockPos(this.posX, d0, this.posZ);
IFluidState ifluidstate = this.world.func_204610_c(blockpos);
- return ifluidstate.func_206884_a(p_208600_1_) && d0 < (double)((float)blockpos.getY() + ifluidstate.func_206885_f() + 0.11111111F);
+ return ifluidstate.isEntityInside(world, blockpos, this, d0, p_208600_1_, true);
double d0 = this.field_70163_u + (double)this.func_70047_e();
BlockPos blockpos = new BlockPos(this.field_70165_t, d0, this.field_70161_v);
IFluidState ifluidstate = this.field_70170_p.func_204610_c(blockpos);
- return ifluidstate.func_206884_a(p_208600_1_) && d0 < (double)((float)blockpos.func_177956_o() + ifluidstate.func_206885_f() + 0.11111111F);
+ return ifluidstate.isEntityInside(field_70170_p, blockpos, this, d0, p_208600_1_, true);
}
}
@@ -1370,6 +1373,7 @@
if (this.glowing) {
compound.setBoolean("Glowing", this.glowing);
if (this.field_184238_ar) {
p_189511_1_.func_74757_a("Glowing", this.field_184238_ar);
}
+ compound.setBoolean("CanUpdate", canUpdate);
+ p_189511_1_.func_74757_a("CanUpdate", canUpdate);
if (!this.tags.isEmpty()) {
if (!this.field_184236_aF.isEmpty()) {
NBTTagList nbttaglist = new NBTTagList();
@@ -1381,6 +1385,9 @@
compound.setTag("Tags", nbttaglist);
p_189511_1_.func_74782_a("Tags", nbttaglist);
}
+ NBTTagCompound caps = serializeCaps();
+ if (caps != null) compound.setTag("ForgeCaps", caps);
+ if (caps != null) p_189511_1_.func_74782_a("ForgeCaps", caps);
+
this.writeEntityToNBT(compound);
if (this.isBeingRidden()) {
this.func_70014_b(p_189511_1_);
if (this.func_184207_aI()) {
NBTTagList nbttaglist1 = new NBTTagList();
@@ -1466,6 +1473,8 @@
this.setSilent(compound.getBoolean("Silent"));
this.setNoGravity(compound.getBoolean("NoGravity"));
this.setGlowing(compound.getBoolean("Glowing"));
+ if (compound.hasKey("CanUpdate", 99)) this.canUpdate(compound.getBoolean("CanUpdate"));
+ if (compound.hasKey("ForgeCaps", 10)) deserializeCaps(compound.getCompoundTag("ForgeCaps"));
if (compound.hasKey("Tags", 9)) {
this.tags.clear();
NBTTagList nbttaglist1 = compound.getTagList("Tags", 8);
this.func_174810_b(p_70020_1_.func_74767_n("Silent"));
this.func_189654_d(p_70020_1_.func_74767_n("NoGravity"));
this.func_184195_f(p_70020_1_.func_74767_n("Glowing"));
+ if (p_70020_1_.func_150297_b("CanUpdate", 99)) this.canUpdate(p_70020_1_.func_74767_n("CanUpdate"));
+ if (p_70020_1_.func_150297_b("ForgeCaps", 10)) deserializeCaps(p_70020_1_.func_74775_l("ForgeCaps"));
if (p_70020_1_.func_150297_b("Tags", 9)) {
this.field_184236_aF.clear();
NBTTagList nbttaglist1 = p_70020_1_.func_150295_c("Tags", 8);
@@ -1546,6 +1555,8 @@
} else {
EntityItem entityitem = new EntityItem(this.world, this.posX, this.posY + (double)offsetY, this.posZ, stack);
entityitem.setDefaultPickupDelay();
EntityItem entityitem = new EntityItem(this.field_70170_p, this.field_70165_t, this.field_70163_u + (double)p_70099_2_, this.field_70161_v, p_70099_1_);
entityitem.func_174869_p();
+ if (captureDrops() != null) captureDrops().add(entityitem);
+ else
this.world.spawnEntity(entityitem);
this.field_70170_p.func_72838_d(entityitem);
return entityitem;
}
@@ -1595,6 +1606,7 @@
this.motionX = 0.0D;
this.motionY = 0.0D;
this.motionZ = 0.0D;
this.field_70159_w = 0.0D;
this.field_70181_x = 0.0D;
this.field_70179_y = 0.0D;
+ if (canUpdate())
this.onUpdate();
if (this.isRiding()) {
entity.updatePassenger(this);
this.func_70071_h_();
if (this.func_184218_aH()) {
entity.func_184232_k(this);
@@ -1636,6 +1648,7 @@
}
}
+ if (!net.minecraftforge.event.ForgeEventFactory.canMountEntity(this, entityIn, true)) return false;
if (force || this.canBeRidden(entityIn) && entityIn.canFitPassenger(this)) {
if (this.isRiding()) {
this.dismountRidingEntity();
+ if (!net.minecraftforge.event.ForgeEventFactory.canMountEntity(this, p_184205_1_, true)) return false;
if (p_184205_2_ || this.func_184228_n(p_184205_1_) && p_184205_1_.func_184219_q(this)) {
if (this.func_184218_aH()) {
this.func_184210_p();
@@ -1663,6 +1676,7 @@
public void dismountRidingEntity() {
if (this.ridingEntity != null) {
Entity entity = this.ridingEntity;
public void func_184210_p() {
if (this.field_184239_as != null) {
Entity entity = this.field_184239_as;
+ if (!net.minecraftforge.event.ForgeEventFactory.canMountEntity(this, entity, false)) return;
this.ridingEntity = null;
entity.removePassenger(this);
this.field_184239_as = null;
entity.func_184225_p(this);
}
@@ -2053,6 +2067,14 @@
@Nullable
public Entity changeDimension(int dimensionIn) {
+ if (this.world.isRemote || this.isDead) return null;
+ return changeDimension(dimensionIn, this.getServer().getWorld(dimensionIn).getDefaultTeleporter());
public Entity func_184204_a(int p_184204_1_) {
+ if (this.field_70170_p.field_72995_K || this.field_70128_L) return null;
+ return changeDimension(p_184204_1_, this.func_184102_h().func_71218_a(p_184204_1_).func_85176_s());
+ }
+
+ @Nullable // Forge: Entities that require custom handling should override this method, not the other
+ public Entity changeDimension(int dimensionIn, net.minecraftforge.common.util.ITeleporter teleporter)
+ public Entity changeDimension(int p_184204_1_, net.minecraftforge.common.util.ITeleporter teleporter)
+ {
+ if (!net.minecraftforge.common.ForgeHooks.onTravelToDimension(this, dimensionIn)) return null;
if (!this.world.isRemote && !this.isDead) {
this.world.profiler.startSection("changeDimension");
MinecraftServer minecraftserver = this.getServer();
+ if (!net.minecraftforge.common.ForgeHooks.onTravelToDimension(this, p_184204_1_)) return null;
if (!this.field_70170_p.field_72995_K && !this.field_70128_L) {
this.field_70170_p.field_72984_F.func_76320_a("changeDimension");
MinecraftServer minecraftserver = this.func_184102_h();
@@ -2060,7 +2082,7 @@
WorldServer worldserver = minecraftserver.getWorld(i);
WorldServer worldserver1 = minecraftserver.getWorld(dimensionIn);
this.dimension = dimensionIn;
- if (i == 1 && dimensionIn == 1) {
+ if (i == 1 && dimensionIn == 1 && teleporter.isVanilla()) {
WorldServer worldserver = minecraftserver.func_71218_a(i);
WorldServer worldserver1 = minecraftserver.func_71218_a(p_184204_1_);
this.field_71093_bK = p_184204_1_;
- if (i == 1 && p_184204_1_ == 1) {
+ if (i == 1 && p_184204_1_ == 1 && teleporter.isVanilla()) {
worldserver1 = minecraftserver.func_200667_a(DimensionType.OVERWORLD);
this.dimension = 0;
this.field_71093_bK = 0;
}
@@ -2069,16 +2091,17 @@
this.isDead = false;
this.world.profiler.startSection("reposition");
this.field_70128_L = false;
this.field_70170_p.field_72984_F.func_76320_a("reposition");
BlockPos blockpos;
- if (dimensionIn == 1) {
+ if (dimensionIn == 1 && teleporter.isVanilla()) {
blockpos = worldserver1.getSpawnCoordinate();
- if (p_184204_1_ == 1) {
+ if (p_184204_1_ == 1 && teleporter.isVanilla()) {
blockpos = worldserver1.func_180504_m();
} else {
- double d0 = this.posX;
- double d1 = this.posZ;
+ double moveFactor = worldserver.provider.getMovementFactor() / worldserver1.provider.getMovementFactor();
+ double d0 = MathHelper.clamp(this.posX * moveFactor, worldserver1.getWorldBorder().minX() + 16.0D, worldserver1.getWorldBorder().maxX() - 16.0D);
+ double d1 = MathHelper.clamp(this.posZ * moveFactor, worldserver1.getWorldBorder().minZ() + 16.0D, worldserver1.getWorldBorder().maxZ() - 16.0D);
- double d0 = this.field_70165_t;
- double d1 = this.field_70161_v;
+ double moveFactor = worldserver.field_73011_w.getMovementFactor() / worldserver1.field_73011_w.getMovementFactor();
+ double d0 = MathHelper.func_151237_a(this.field_70165_t * moveFactor, worldserver1.func_175723_af().func_177726_b() + 16.0D, worldserver1.func_175723_af().func_177728_d() - 16.0D);
+ double d1 = MathHelper.func_151237_a(this.field_70161_v * moveFactor, worldserver1.func_175723_af().func_177736_c() + 16.0D, worldserver1.func_175723_af().func_177733_e() - 16.0D);
double d2 = 8.0D;
- if (dimensionIn == -1) {
+ if (false && dimensionIn == -1) {
d0 = MathHelper.clamp(d0 / 8.0D, worldserver1.getWorldBorder().minX() + 16.0D, worldserver1.getWorldBorder().maxX() - 16.0D);
d1 = MathHelper.clamp(d1 / 8.0D, worldserver1.getWorldBorder().minZ() + 16.0D, worldserver1.getWorldBorder().maxZ() - 16.0D);
- } else if (dimensionIn == 0) {
+ } else if (false && dimensionIn == 0) {
d0 = MathHelper.clamp(d0 * 8.0D, worldserver1.getWorldBorder().minX() + 16.0D, worldserver1.getWorldBorder().maxX() - 16.0D);
d1 = MathHelper.clamp(d1 * 8.0D, worldserver1.getWorldBorder().minZ() + 16.0D, worldserver1.getWorldBorder().maxZ() - 16.0D);
- if (p_184204_1_ == -1) {
+ if (false && p_184204_1_ == -1) {
d0 = MathHelper.func_151237_a(d0 / 8.0D, worldserver1.func_175723_af().func_177726_b() + 16.0D, worldserver1.func_175723_af().func_177728_d() - 16.0D);
d1 = MathHelper.func_151237_a(d1 / 8.0D, worldserver1.func_175723_af().func_177736_c() + 16.0D, worldserver1.func_175723_af().func_177733_e() - 16.0D);
- } else if (p_184204_1_ == 0) {
+ } else if (false && p_184204_1_ == 0) {
d0 = MathHelper.func_151237_a(d0 * 8.0D, worldserver1.func_175723_af().func_177726_b() + 16.0D, worldserver1.func_175723_af().func_177728_d() - 16.0D);
d1 = MathHelper.func_151237_a(d1 * 8.0D, worldserver1.func_175723_af().func_177736_c() + 16.0D, worldserver1.func_175723_af().func_177733_e() - 16.0D);
}
@@ -2087,8 +2110,7 @@
d1 = (double)MathHelper.clamp((int)d1, -29999872, 29999872);
float f = this.rotationYaw;
this.setLocationAndAngles(d0, this.posY, d1, 90.0F, 0.0F);
- Teleporter teleporter = worldserver1.getDefaultTeleporter();
- teleporter.placeInExistingPortal(this, f);
d1 = (double)MathHelper.func_76125_a((int)d1, -29999872, 29999872);
float f = this.field_70177_z;
this.func_70012_b(d0, this.field_70163_u, d1, 90.0F, 0.0F);
- Teleporter teleporter = worldserver1.func_85176_s();
- teleporter.func_180620_b(this, f);
+ teleporter.placeEntity(worldserver1, this, f);
blockpos = new BlockPos(this);
}
@ -173,11 +173,11 @@
@@ -2097,7 +2119,7 @@
Entity entity = this.func_200600_R().func_200721_a(worldserver1);
if (entity != null) {
entity.copyDataFromOld(this);
- if (i == 1 && dimensionIn == 1) {
+ if (i == 1 && dimensionIn == 1 && teleporter.isVanilla()) {
BlockPos blockpos1 = worldserver1.func_205770_a(Heightmap.Type.MOTION_BLOCKING_NO_LEAVES, worldserver1.getSpawnPoint());
entity.moveToBlockPosAndAngles(blockpos1, entity.rotationYaw, entity.rotationPitch);
entity.func_180432_n(this);
- if (i == 1 && p_184204_1_ == 1) {
+ if (i == 1 && p_184204_1_ == 1 && teleporter.isVanilla()) {
BlockPos blockpos1 = worldserver1.func_205770_a(Heightmap.Type.MOTION_BLOCKING_NO_LEAVES, worldserver1.func_175694_M());
entity.func_174828_a(blockpos1, entity.field_70177_z, entity.field_70125_A);
} else {
@@ -2591,4 +2613,32 @@
public double func_212107_bY() {
@ -206,9 +206,9 @@
+ }
+ @Override
+ public boolean canTrample(IBlockState state, BlockPos pos, float fallDistance) {
+ return world.rand.nextFloat() < fallDistance - 0.5F
+ return field_70170_p.field_73012_v.nextFloat() < fallDistance - 0.5F
+ && this instanceof EntityLivingBase
+ && (this instanceof EntityPlayer || net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(world, this))
+ && this.width * this.width * this.height > 0.512F;
+ && (this instanceof EntityPlayer || net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(field_70170_p, this))
+ && this.field_70130_N * this.field_70130_N * this.field_70131_O > 0.512F;
+ }
}

View File

@ -1,18 +1,18 @@
--- a/net/minecraft/entity/item/EntityMinecart.java
+++ b/net/minecraft/entity/item/EntityMinecart.java
@@ -808,4 +808,15 @@
return idIn >= 0 && idIn < BY_ID.length ? BY_ID[idIn] : RIDEABLE;
return p_184955_0_ >= 0 && p_184955_0_ < field_184965_h.length ? field_184965_h[p_184955_0_] : RIDEABLE;
}
}
+
+ public ItemStack getCartItem() {
+ switch (getType()) {
+ case FURNACE: return new ItemStack(Items.FURNACE_MINECART);
+ case CHEST: return new ItemStack(Items.CHEST_MINECART);
+ case TNT: return new ItemStack(Items.TNT_MINECART);
+ case HOPPER: return new ItemStack(Items.HOPPER_MINECART);
+ case COMMAND_BLOCK: return new ItemStack(Items.COMMAND_BLOCK_MINECART);
+ default: return new ItemStack(Items.MINECART);
+ switch (func_184264_v()) {
+ case FURNACE: return new ItemStack(Items.field_151109_aJ);
+ case CHEST: return new ItemStack(Items.field_151108_aI);
+ case TNT: return new ItemStack(Items.field_151142_bV);
+ case HOPPER: return new ItemStack(Items.field_151140_bW);
+ case COMMAND_BLOCK: return new ItemStack(Items.field_151095_cc);
+ default: return new ItemStack(Items.field_151143_au);
+ }
+ }
}

View File

@ -2,48 +2,48 @@
+++ b/net/minecraft/entity/monster/EntityZombieVillager.java
@@ -49,15 +49,18 @@
public void setProfession(int profession) {
this.dataManager.set(PROFESSION, profession);
+ net.minecraftforge.fml.common.registry.VillagerRegistry.onSetProfession(this, profession);
public void func_190733_a(int p_190733_1_) {
this.field_70180_af.func_187227_b(field_190739_c, p_190733_1_);
+ net.minecraftforge.fml.common.registry.VillagerRegistry.onSetProfession(this, p_190733_1_);
}
+ @Deprecated // Use Forge Variant below
public int getProfession() {
- return Math.max(this.dataManager.get(PROFESSION) % 6, 0);
+ return Math.max(this.dataManager.get(PROFESSION), 0);
public int func_190736_dl() {
- return Math.max(this.field_70180_af.func_187225_a(field_190739_c) % 6, 0);
+ return Math.max(this.field_70180_af.func_187225_a(field_190739_c), 0);
}
public void writeEntityToNBT(NBTTagCompound compound) {
super.writeEntityToNBT(compound);
compound.setInteger("Profession", this.getProfession());
+ compound.setString("ProfessionName", this.getForgeProfession().getRegistryName().toString());
compound.setInteger("ConversionTime", this.isConverting() ? this.conversionTime : -1);
if (this.converstionStarter != null) {
compound.setUniqueId("ConversionPlayer", this.converstionStarter);
public void func_70014_b(NBTTagCompound p_70014_1_) {
super.func_70014_b(p_70014_1_);
p_70014_1_.func_74768_a("Profession", this.func_190736_dl());
+ p_70014_1_.func_74778_a("ProfessionName", this.getForgeProfession().getRegistryName().toString());
p_70014_1_.func_74768_a("ConversionTime", this.func_82230_o() ? this.field_82234_d : -1);
if (this.field_191992_by != null) {
p_70014_1_.func_186854_a("ConversionPlayer", this.field_191992_by);
@@ -68,6 +71,11 @@
public void readEntityFromNBT(NBTTagCompound compound) {
super.readEntityFromNBT(compound);
this.setProfession(compound.getInteger("Profession"));
+ if (compound.hasKey("ProfessionName")) {
+ net.minecraftforge.fml.common.registry.VillagerRegistry.VillagerProfession p = net.minecraftforge.registries.ForgeRegistries.VILLAGER_PROFESSIONS.getValue(new net.minecraft.util.ResourceLocation(compound.getString("ProfessionName")));
public void func_70037_a(NBTTagCompound p_70037_1_) {
super.func_70037_a(p_70037_1_);
this.func_190733_a(p_70037_1_.func_74762_e("Profession"));
+ if (p_70037_1_.func_74764_b("ProfessionName")) {
+ net.minecraftforge.fml.common.registry.VillagerRegistry.VillagerProfession p = net.minecraftforge.registries.ForgeRegistries.VILLAGER_PROFESSIONS.getValue(new net.minecraft.util.ResourceLocation(p_70037_1_.func_74779_i("ProfessionName")));
+ if (p == null) p = net.minecraftforge.fml.common.registry.VillagerRegistry.FARMER.orElseThrow(() -> new IllegalStateException("Farmer profession not initialized?"));
+ this.setForgeProfession(p);
+ }
if (compound.hasKey("ConversionTime", 99) && compound.getInteger("ConversionTime") > -1) {
this.startConverting(compound.hasUniqueId("ConversionPlayer") ? compound.getUniqueId("ConversionPlayer") : null, compound.getInteger("ConversionTime"));
if (p_70037_1_.func_150297_b("ConversionTime", 99) && p_70037_1_.func_74762_e("ConversionTime") > -1) {
this.func_191991_a(p_70037_1_.func_186855_b("ConversionPlayer") ? p_70037_1_.func_186857_a("ConversionPlayer") : null, p_70037_1_.func_74762_e("ConversionTime"));
}
@@ -145,7 +153,7 @@
protected void finishConversion() {
EntityVillager entityvillager = new EntityVillager(this.world);
entityvillager.copyLocationAndAnglesFrom(this);
- entityvillager.setProfession(this.getProfession());
protected void func_190738_dp() {
EntityVillager entityvillager = new EntityVillager(this.field_70170_p);
entityvillager.func_82149_j(this);
- entityvillager.func_70938_b(this.func_190736_dl());
+ entityvillager.setProfession(this.getForgeProfession());
entityvillager.finalizeMobSpawn(this.world.getDifficultyForLocation(new BlockPos(entityvillager)), (IEntityLivingData)null, (NBTTagCompound)null, false);
entityvillager.setLookingForHome();
if (this.isChild()) {
entityvillager.func_190672_a(this.field_70170_p.func_175649_E(new BlockPos(entityvillager)), (IEntityLivingData)null, (NBTTagCompound)null, false);
entityvillager.func_82187_q();
if (this.func_70631_g_()) {
@@ -224,4 +232,37 @@
protected ItemStack getSkullDrop() {
return ItemStack.EMPTY;
protected ItemStack func_190732_dj() {
return ItemStack.field_190927_a;
}
+
+ /* ======================================== FORGE START =====================================*/
@ -53,14 +53,14 @@
+ public void setForgeProfession(net.minecraftforge.fml.common.registry.VillagerRegistry.VillagerProfession prof)
+ {
+ this.prof = prof;
+ this.setProfession(net.minecraftforge.fml.common.registry.VillagerRegistry.getId(prof));
+ this.func_190733_a(net.minecraftforge.fml.common.registry.VillagerRegistry.getId(prof));
+ }
+
+ public net.minecraftforge.fml.common.registry.VillagerRegistry.VillagerProfession getForgeProfession()
+ {
+ if (this.prof == null)
+ {
+ this.prof = net.minecraftforge.fml.common.registry.VillagerRegistry.getById(this.getProfession());
+ this.prof = net.minecraftforge.fml.common.registry.VillagerRegistry.getById(this.func_190736_dl());
+ if (this.prof == null)
+ return net.minecraftforge.fml.common.registry.VillagerRegistry.FARMER.orElseThrow(() -> new IllegalStateException("Farmer profession not initialized?"));
+ }
@ -68,12 +68,12 @@
+ }
+
+ @Override
+ public void notifyDataManagerChange(DataParameter<?> key)
+ public void func_184206_a(DataParameter<?> key)
+ {
+ super.notifyDataManagerChange(key);
+ if (key.equals(PROFESSION))
+ super.func_184206_a(key);
+ if (key.equals(field_190739_c))
+ {
+ net.minecraftforge.fml.common.registry.VillagerRegistry.onSetProfession(this, this.dataManager.get(PROFESSION));
+ net.minecraftforge.fml.common.registry.VillagerRegistry.onSetProfession(this, this.field_70180_af.func_187225_a(field_190739_c));
+ }
+ }
+

View File

@ -1,71 +1,80 @@
--- a/net/minecraft/entity/passive/EntityVillager.java
+++ b/net/minecraft/entity/passive/EntityVillager.java
@@ -105,7 +105,7 @@
private boolean needsInitilization;
private boolean isWillingToMate;
private int wealth;
- private String lastBuyingPlayer;
+ private java.util.UUID lastBuyingPlayer;
private int careerId;
private int careerLevel;
private boolean isLookingForHome;
private boolean field_70959_by;
private boolean field_175565_bs;
private int field_70956_bz;
- private String field_82189_bL;
+ private java.util.UUID field_82189_bL;
private int field_175563_bv;
private int field_175562_bw;
private boolean field_82190_bM;
@@ -203,7 +203,7 @@
this.field_70959_by = false;
if (this.field_70954_d != null && this.field_82189_bL != null) {
this.field_70170_p.func_72960_a(this, (byte)14);
- this.field_70954_d.func_82688_a(this.field_82189_bL, 1);
+ this.field_70954_d.modifyPlayerReputation(this.field_82189_bL, 1);
}
}
@@ -220,7 +220,7 @@
if (flag) {
itemstack.interactWithEntity(player, this, hand);
itemstack.func_111282_a(p_184645_1_, this, p_184645_2_);
return true;
- } else if (itemstack.getItem() != Items.field_196172_da && this.isEntityAlive() && !this.isTrading() && !this.isChild()) {
+ } else if (itemstack.getItem() != Items.field_196172_da && this.isEntityAlive() && !this.isTrading() && !this.isChild() && !player.isSneaking()) {
if (this.buyingList == null) {
this.populateBuyingList();
- } else if (itemstack.func_77973_b() != Items.field_196172_da && this.func_70089_S() && !this.func_70940_q() && !this.func_70631_g_()) {
+ } else if (itemstack.func_77973_b() != Items.field_196172_da && this.func_70089_S() && !this.func_70940_q() && !this.func_70631_g_() && !p_184645_1_.func_70093_af()) {
if (this.field_70963_i == null) {
this.func_175554_cu();
}
@@ -250,6 +250,7 @@
public void writeEntityToNBT(NBTTagCompound compound) {
super.writeEntityToNBT(compound);
compound.setInteger("Profession", this.getProfession());
+ compound.setString("ProfessionName", this.getProfessionForge().getRegistryName().toString());
compound.setInteger("Riches", this.wealth);
compound.setInteger("Career", this.careerId);
compound.setInteger("CareerLevel", this.careerLevel);
public void func_70014_b(NBTTagCompound p_70014_1_) {
super.func_70014_b(p_70014_1_);
p_70014_1_.func_74768_a("Profession", this.func_70946_n());
+ p_70014_1_.func_74778_a("ProfessionName", this.getProfessionForge().getRegistryName().toString());
p_70014_1_.func_74768_a("Riches", this.field_70956_bz);
p_70014_1_.func_74768_a("Career", this.field_175563_bv);
p_70014_1_.func_74768_a("CareerLevel", this.field_175562_bw);
@@ -273,6 +274,14 @@
public void readEntityFromNBT(NBTTagCompound compound) {
super.readEntityFromNBT(compound);
this.setProfession(compound.getInteger("Profession"));
+ if (compound.hasKey("ProfessionName"))
public void func_70037_a(NBTTagCompound p_70037_1_) {
super.func_70037_a(p_70037_1_);
this.func_70938_b(p_70037_1_.func_74762_e("Profession"));
+ if (p_70037_1_.func_74764_b("ProfessionName"))
+ {
+ net.minecraftforge.fml.common.registry.VillagerRegistry.VillagerProfession p =
+ net.minecraftforge.registries.ForgeRegistries.VILLAGER_PROFESSIONS.getValue(new net.minecraft.util.ResourceLocation(compound.getString("ProfessionName")));
+ net.minecraftforge.registries.ForgeRegistries.VILLAGER_PROFESSIONS.getValue(new net.minecraft.util.ResourceLocation(p_70037_1_.func_74779_i("ProfessionName")));
+ if (p == null)
+ p = net.minecraftforge.registries.ForgeRegistries.VILLAGER_PROFESSIONS.getValue(new net.minecraft.util.ResourceLocation("minecraft:farmer"));
+ this.setProfession(p);
+ }
this.wealth = compound.getInteger("Riches");
this.careerId = compound.getInteger("Career");
this.careerLevel = compound.getInteger("CareerLevel");
this.field_70956_bz = p_70037_1_.func_74762_e("Riches");
this.field_175563_bv = p_70037_1_.func_74762_e("Career");
this.field_175562_bw = p_70037_1_.func_74762_e("CareerLevel");
@@ -318,12 +327,42 @@
public void setProfession(int professionId) {
this.dataManager.set(PROFESSION, professionId);
+ net.minecraftforge.fml.common.registry.VillagerRegistry.onSetProfession(this, professionId);
public void func_70938_b(int p_70938_1_) {
this.field_70180_af.func_187227_b(field_184752_bw, p_70938_1_);
+ net.minecraftforge.fml.common.registry.VillagerRegistry.onSetProfession(this, p_70938_1_);
}
+ @Deprecated // Use Forge Variant below
public int getProfession() {
- return Math.max(this.dataManager.get(PROFESSION) % 6, 0);
+ return Math.max(this.dataManager.get(PROFESSION), 0);
public int func_70946_n() {
- return Math.max(this.field_70180_af.func_187225_a(field_184752_bw) % 6, 0);
+ return Math.max(this.field_70180_af.func_187225_a(field_184752_bw), 0);
}
+ private net.minecraftforge.fml.common.registry.VillagerRegistry.VillagerProfession prof;
+ public void setProfession(net.minecraftforge.fml.common.registry.VillagerRegistry.VillagerProfession prof)
+ {
+ this.prof = prof;
+ this.setProfession(net.minecraftforge.fml.common.registry.VillagerRegistry.getId(prof));
+ this.func_70938_b(net.minecraftforge.fml.common.registry.VillagerRegistry.getId(prof));
+ }
+
+ public net.minecraftforge.fml.common.registry.VillagerRegistry.VillagerProfession getProfessionForge()
+ {
+ if (this.prof == null)
+ {
+ this.prof = net.minecraftforge.fml.common.registry.VillagerRegistry.getById(this.getProfession());
+ this.prof = net.minecraftforge.fml.common.registry.VillagerRegistry.getById(this.func_70946_n());
+ if (this.prof == null)
+ return net.minecraftforge.fml.common.registry.VillagerRegistry.getById(0); //Farmer
+ }
@ -73,56 +82,56 @@
+ }
+
+ @Override
+ public void notifyDataManagerChange(DataParameter<?> key)
+ public void func_184206_a(DataParameter<?> key)
+ {
+ super.notifyDataManagerChange(key);
+ if (key.equals(PROFESSION))
+ super.func_184206_a(key);
+ if (key.equals(field_184752_bw))
+ {
+ net.minecraftforge.fml.common.registry.VillagerRegistry.onSetProfession(this, this.dataManager.get(PROFESSION));
+ net.minecraftforge.fml.common.registry.VillagerRegistry.onSetProfession(this, this.field_70180_af.func_187225_a(field_184752_bw));
+ }
+ }
+
public boolean isMating() {
return this.isMating;
public boolean func_70941_o() {
return this.field_70952_f;
}
@@ -433,7 +472,7 @@
this.needsInitilization = true;
this.isWillingToMate = true;
if (this.buyingPlayer != null) {
- this.lastBuyingPlayer = this.buyingPlayer.getGameProfile().getName();
+ this.lastBuyingPlayer = this.buyingPlayer.getUniqueID();
this.field_70959_by = true;
this.field_175565_bs = true;
if (this.field_70962_h != null) {
- this.field_82189_bL = this.field_70962_h.func_146103_bH().getName();
+ this.field_82189_bL = this.field_70962_h.func_110124_au();
} else {
this.lastBuyingPlayer = null;
this.field_82189_bL = null;
}
@@ -473,11 +512,10 @@
}
private void populateBuyingList() {
- EntityVillager.ITradeList[][][] aentityvillager$itradelist = DEFAULT_TRADE_LIST_MAP[this.getProfession()];
if (this.careerId != 0 && this.careerLevel != 0) {
++this.careerLevel;
private void func_175554_cu() {
- EntityVillager.ITradeList[][][] aentityvillager$itradelist = field_175561_bA[this.func_70946_n()];
if (this.field_175563_bv != 0 && this.field_175562_bw != 0) {
++this.field_175562_bw;
} else {
- this.careerId = this.rand.nextInt(aentityvillager$itradelist.length) + 1;
+ this.careerId = this.getProfessionForge().getRandomCareer(this.rand) + 1;
this.careerLevel = 1;
- this.field_175563_bv = this.field_70146_Z.nextInt(aentityvillager$itradelist.length) + 1;
+ this.field_175563_bv = this.getProfessionForge().getRandomCareer(this.field_70146_Z) + 1;
this.field_175562_bw = 1;
}
@@ -487,16 +525,11 @@
int i = this.careerId - 1;
int j = this.careerLevel - 1;
int i = this.field_175563_bv - 1;
int j = this.field_175562_bw - 1;
- if (i >= 0 && i < aentityvillager$itradelist.length) {
- EntityVillager.ITradeList[][] aentityvillager$itradelist1 = aentityvillager$itradelist[i];
- if (j >= 0 && j < aentityvillager$itradelist1.length) {
- EntityVillager.ITradeList[] aentityvillager$itradelist2 = aentityvillager$itradelist1[j];
-
- for(EntityVillager.ITradeList entityvillager$itradelist : aentityvillager$itradelist2) {
- entityvillager$itradelist.addMerchantRecipe(this, this.buyingList, this.rand);
- entityvillager$itradelist.func_190888_a(this, this.field_70963_i, this.field_70146_Z);
- }
+ java.util.List<EntityVillager.ITradeList> trades = this.getProfessionForge().getCareer(i).getTrades(j);
+ if (i >= 0 && trades != null) {
+ for (EntityVillager.ITradeList entityvillager$itradelist : trades) {
+ entityvillager$itradelist.addMerchantRecipe(this, this.buyingList, this.rand);
+ entityvillager$itradelist.func_190888_a(this, this.field_70963_i, this.field_70146_Z);
}
-
}
@ -133,37 +142,37 @@
}
- if (s != null) {
+ s = this.getProfessionForge().getCareer(this.careerId-1).getName();
+ s = this.getProfessionForge().getCareer(this.field_175563_bv-1).getName();
ITextComponent itextcomponent1 = (new TextComponentTranslation(this.func_200600_R().func_210760_d() + '.' + s, new Object[0])).func_211710_a((p_211520_1_) -> {
p_211520_1_.setHoverEvent(this.getHoverEvent()).setInsertion(this.getCachedUniqueIdString());
p_211520_1_.func_150209_a(this.func_174823_aP()).func_179989_a(this.func_189512_bd());
});
@@ -576,9 +609,6 @@
}
return itextcomponent1;
- } else {
- return super.getDisplayName();
- return super.func_145748_c_();
- }
}
}
@@ -619,7 +649,7 @@
public IEntityLivingData finalizeMobSpawn(DifficultyInstance p_190672_1_, @Nullable IEntityLivingData p_190672_2_, @Nullable NBTTagCompound p_190672_3_, boolean p_190672_4_) {
public IEntityLivingData func_190672_a(DifficultyInstance p_190672_1_, @Nullable IEntityLivingData p_190672_2_, @Nullable NBTTagCompound p_190672_3_, boolean p_190672_4_) {
p_190672_2_ = super.func_204210_a(p_190672_1_, p_190672_2_, p_190672_3_);
if (p_190672_4_) {
- this.setProfession(this.world.rand.nextInt(6));
+ net.minecraftforge.fml.common.registry.VillagerRegistry.setRandomProfession(this, this.world.rand);
- this.func_70938_b(this.field_70170_p.field_73012_v.nextInt(6));
+ net.minecraftforge.fml.common.registry.VillagerRegistry.setRandomProfession(this, this.field_70170_p.field_73012_v);
}
this.setAdditionalAItasks();
this.func_175552_ct();
@@ -817,6 +847,10 @@
recipeList.add(new MerchantRecipe(itemstack, itemstack1));
p_190888_2_.add(new MerchantRecipe(itemstack, itemstack1));
}
}
+
+ //MODDERS DO NOT USE OR EDIT THIS IN ANY WAY IT WILL HAVE NO EFFECT, THIS IS JUST IN HERE TO ALLOW FORGE TO ACCESS IT
+ @Deprecated
+ public static ITradeList[][][][] GET_TRADES_DONT_USE(){ return DEFAULT_TRADE_LIST_MAP; }
+ public static ITradeList[][][][] GET_TRADES_DONT_USE(){ return field_175561_bA; }
public static class ListItemForEmeralds implements EntityVillager.ITradeList {
public ItemStack itemToBuy;
public ItemStack field_179403_a;

View File

@ -4,29 +4,29 @@
import net.minecraftforge.api.distmarker.OnlyIn;
public abstract class EntityPlayer extends EntityLivingBase {
+ public static final net.minecraft.entity.ai.attributes.IAttribute REACH_DISTANCE = new net.minecraft.entity.ai.attributes.RangedAttribute(null, "generic.reachDistance", 5.0D, 0.0D, 1024.0D).setShouldWatch(true);
+ public static final net.minecraft.entity.ai.attributes.IAttribute REACH_DISTANCE = new net.minecraft.entity.ai.attributes.RangedAttribute(null, "generic.reachDistance", 5.0D, 0.0D, 1024.0D).func_111112_a(true);
+
private static final DataParameter<Float> ABSORPTION = EntityDataManager.<Float>createKey(EntityPlayer.class, DataSerializers.FLOAT);
private static final DataParameter<Integer> PLAYER_SCORE = EntityDataManager.<Integer>createKey(EntityPlayer.class, DataSerializers.VARINT);
protected static final DataParameter<Byte> PLAYER_MODEL_FLAG = EntityDataManager.<Byte>createKey(EntityPlayer.class, DataSerializers.BYTE);
private static final DataParameter<Float> field_184829_a = EntityDataManager.<Float>func_187226_a(EntityPlayer.class, DataSerializers.field_187193_c);
private static final DataParameter<Integer> field_184830_b = EntityDataManager.<Integer>func_187226_a(EntityPlayer.class, DataSerializers.field_187192_b);
protected static final DataParameter<Byte> field_184827_bp = EntityDataManager.<Byte>func_187226_a(EntityPlayer.class, DataSerializers.field_187191_a);
@@ -663,7 +665,12 @@
return p_184816_1_.getItem();
return p_184816_1_.func_92059_d();
}
+ @Deprecated //Use location sensitive version below
public float getDigSpeed(IBlockState state) {
+ return getDigSpeed(state, null);
public float func_184813_a(IBlockState p_184813_1_) {
+ return getDigSpeed(p_184813_1_, null);
+ }
+
+ public float getDigSpeed(IBlockState state, @Nullable BlockPos pos) {
float f = this.inventory.getDestroySpeed(state);
+ public float getDigSpeed(IBlockState p_184813_1_, @Nullable BlockPos pos) {
float f = this.field_71071_by.func_184438_a(p_184813_1_);
if (f > 1.0F) {
int i = EnchantmentHelper.getEfficiencyModifier(this);
int i = EnchantmentHelper.func_185293_e(this);
@@ -705,6 +712,7 @@
f /= 5.0F;
}
+ f = net.minecraftforge.event.ForgeEventFactory.getBreakSpeed(this, state, f, pos);
+ f = net.minecraftforge.event.ForgeEventFactory.getBreakSpeed(this, p_184813_1_, f, pos);
return f;
}

View File

@ -6,5 +6,5 @@
+@net.minecraftforge.registries.ObjectHolder("minecraft")
public abstract class Biomes {
public static final Biome OCEAN;
public static final Biome DEFAULT;
public static final Biome field_76771_b;
public static final Biome field_180279_ad;

View File

@ -6,5 +6,5 @@
+@net.minecraftforge.registries.ObjectHolder("minecraft")
public class Blocks {
private static final Set<Block> CACHE;
public static final Block AIR;
private static final Set<Block> field_185780_dg;
public static final Block field_150350_a;

View File

@ -10,7 +10,7 @@
@@ -421,6 +422,8 @@
redirectOutputToLog();
func_179868_d();
}
+ net.minecraftforge.registries.ForgeRegistries.ITEMS.getClass(); // TODO figure out a better way to ensure these are initialized
+ net.minecraft.tileentity.TileEntityType.field_200970_a.getClass();

View File

@ -6,5 +6,5 @@
+@net.minecraftforge.registries.ObjectHolder("minecraft")
public class Enchantments {
public static final Enchantment PROTECTION = getRegisteredEnchantment("protection");
public static final Enchantment FIRE_PROTECTION = getRegisteredEnchantment("fire_protection");
public static final Enchantment field_180310_c = func_185295_a("protection");
public static final Enchantment field_77329_d = func_185295_a("fire_protection");

View File

@ -6,5 +6,5 @@
+@net.minecraftforge.registries.ObjectHolder("minecraft")
public class Items {
public static final Item AIR;
public static final Item IRON_SHOVEL;
public static final Item field_190931_a;
public static final Item field_151037_a;

View File

@ -6,5 +6,5 @@
+@net.minecraftforge.registries.ObjectHolder("minecraft")
public class MobEffects {
public static final Potion SPEED;
public static final Potion SLOWNESS;
public static final Potion field_76424_c;
public static final Potion field_76421_d;

View File

@ -6,5 +6,5 @@
+@net.minecraftforge.registries.ObjectHolder("minecraft")
public class PotionTypes {
private static final Set<PotionType> CACHE;
public static final PotionType EMPTY;
private static final Set<PotionType> field_185228_K;
public static final PotionType field_185229_a;

View File

@ -6,5 +6,5 @@
+@net.minecraftforge.registries.ObjectHolder("minecraft")
public class SoundEvents {
public static final SoundEvent AMBIENT_CAVE;
public static final SoundEvent field_187674_a;
public static final SoundEvent field_204326_e;

View File

@ -2,7 +2,7 @@
+++ b/net/minecraft/item/ArmorMaterial.java
@@ -77,4 +77,8 @@
public float func_200901_e() {
return this.toughness;
return this.field_189417_k;
}
+
+ public static ArmorMaterial create(String name, String p_i48533_3_, int p_i48533_4_, int[] p_i48533_5_, int p_i48533_6_, SoundEvent p_i48533_7_, float p_i48533_8_, Supplier<Ingredient> p_i48533_9_) {

View File

@ -2,7 +2,7 @@
+++ b/net/minecraft/item/EnumDyeColor.java
@@ -44,6 +44,7 @@
private final int field_196066_w;
private final float[] colorComponentValues;
private final float[] field_193352_x;
private final int field_196067_y;
+ private final net.minecraft.tags.Tag<Item> tag;
@ -10,15 +10,15 @@
this.field_196064_s = p_i47810_3_;
@@ -56,6 +57,7 @@
this.field_196066_w = k << 16 | j << 8 | i << 0;
this.colorComponentValues = new float[]{(float)i / 255.0F, (float)j / 255.0F, (float)k / 255.0F};
this.field_193352_x = new float[]{(float)i / 255.0F, (float)j / 255.0F, (float)k / 255.0F};
this.field_196067_y = p_i47810_7_;
+ this.tag = new net.minecraft.tags.ItemTags.Wrapper(new net.minecraft.util.ResourceLocation("minecraft", "dyes_" + p_i47810_4_));
}
public int func_196059_a() {
@@ -114,4 +116,21 @@
public String getName() {
return this.translationKey;
public String func_176610_l() {
return this.field_176785_v;
}
+
+ public net.minecraft.tags.Tag<Item> getTag() {
@ -27,11 +27,11 @@
+
+ @Nullable
+ public static EnumDyeColor getColor(ItemStack stack) {
+ if (stack.getItem() instanceof ItemDye)
+ return ((ItemDye)stack.getItem()).func_195962_g();
+ if (stack.func_77973_b() instanceof ItemDye)
+ return ((ItemDye)stack.func_77973_b()).func_195962_g();
+
+ for (EnumDyeColor color : field_196062_q) {
+ if (stack.getItem().func_206844_a(color.getTag()))
+ if (stack.func_77973_b().func_206844_a(color.getTag()))
+ return color;
+ }
+

View File

@ -5,80 +5,80 @@
import net.minecraftforge.api.distmarker.OnlyIn;
-public class Item implements IItemProvider {
- public static final RegistryNamespaced<ResourceLocation, Item> REGISTRY = new RegistryNamespaced<ResourceLocation, Item>();
- public static final Map<Block, Item> BLOCK_TO_ITEM = Maps.<Block, Item>newHashMap();
- public static final RegistryNamespaced<ResourceLocation, Item> field_150901_e = new RegistryNamespaced<ResourceLocation, Item>();
- public static final Map<Block, Item> field_179220_a = Maps.<Block, Item>newHashMap();
+public class Item extends net.minecraftforge.registries.ForgeRegistryEntry<Item> implements IItemProvider, net.minecraftforge.common.extensions.IForgeItem {
+ public static final RegistryNamespaced<ResourceLocation, Item> REGISTRY = net.minecraftforge.registries.GameData.getWrapper(Item.class);
+ public static final Map<Block, Item> BLOCK_TO_ITEM = net.minecraftforge.registries.GameData.getBlockItemMap();
private static final IItemPropertyGetter DAMAGED_GETTER = (p_210306_0_, p_210306_1_, p_210306_2_) -> {
return p_210306_0_.isItemDamaged() ? 1.0F : 0.0F;
+ public static final RegistryNamespaced<ResourceLocation, Item> field_150901_e = net.minecraftforge.registries.GameData.getWrapper(Item.class);
+ public static final Map<Block, Item> field_179220_a = net.minecraftforge.registries.GameData.getBlockItemMap();
private static final IItemPropertyGetter field_185046_b = (p_210306_0_, p_210306_1_, p_210306_2_) -> {
return p_210306_0_.func_77951_h() ? 1.0F : 0.0F;
};
@@ -126,6 +126,10 @@
this.containerItem = p_i48487_1_.field_200922_c;
this.maxDamage = p_i48487_1_.field_200921_b;
this.maxStackSize = p_i48487_1_.field_200920_a;
this.field_77700_c = p_i48487_1_.field_200922_c;
this.field_77699_b = p_i48487_1_.field_200921_b;
this.field_77777_bU = p_i48487_1_.field_200920_a;
+ this.canRepair = p_i48487_1_.canRepair;
+ this.toolClasses.putAll(p_i48487_1_.toolClasses);
+ Object tmp = p_i48487_1_.teisr == null ? null : net.minecraftforge.fml.DistExecutor.callWhenOn(Dist.CLIENT, p_i48487_1_.teisr);
+ this.teisr = tmp == null ? null : () -> (net.minecraft.client.renderer.tileentity.TileEntityItemStackRenderer) tmp;
if (this.maxDamage > 0) {
this.addPropertyOverride(new ResourceLocation("damaged"), DAMAGED_GETTER);
this.addPropertyOverride(new ResourceLocation("damage"), DAMAGE_GETTER);
if (this.field_77699_b > 0) {
this.func_185043_a(new ResourceLocation("damaged"), field_185046_b);
this.func_185043_a(new ResourceLocation("damage"), field_185047_c);
@@ -149,10 +153,12 @@
return stack;
return p_77654_1_;
}
+ @Deprecated // Use ItemStack sensitive version.
public final int getItemStackLimit() {
return this.maxStackSize;
public final int func_77639_j() {
return this.field_77777_bU;
}
+ @Deprecated // Use ItemStack sensitive version.
public final int getMaxDamage() {
return this.maxDamage;
public final int func_77612_l() {
return this.field_77699_b;
}
@@ -207,6 +213,7 @@
return this.containerItem;
return this.field_77700_c;
}
+ @Deprecated // Use ItemStack sensitive version.
public boolean hasContainerItem() {
return this.containerItem != null;
public boolean func_77634_r() {
return this.field_77700_c != null;
}
@@ -263,7 +270,7 @@
}
public boolean isEnchantable(ItemStack stack) {
- return this.getItemStackLimit() == 1 && this.isDamageable();
+ return this.getItemStackLimit(stack) == 1 && this.isDamageable();
public boolean func_77616_k(ItemStack p_77616_1_) {
- return this.func_77639_j() == 1 && this.func_77645_m();
+ return this.getItemStackLimit(p_77616_1_) == 1 && this.func_77645_m();
}
@Nullable
@@ -280,8 +287,8 @@
float f5 = MathHelper.sin(-f * ((float)Math.PI / 180F));
float f5 = MathHelper.func_76126_a(-f * ((float)Math.PI / 180F));
float f6 = f3 * f4;
float f7 = f2 * f4;
- double d3 = 5.0D;
- Vec3d vec3d1 = vec3d.add((double)f6 * 5.0D, (double)f5 * 5.0D, (double)f7 * 5.0D);
+ double d3 = playerIn.getEntityAttribute(EntityPlayer.REACH_DISTANCE).getAttributeValue();
+ Vec3d vec3d1 = vec3d.add((double)f6 * d3, (double)f5 * d3, (double)f7 * d3);
return worldIn.func_200259_a(vec3d, vec3d1, useLiquids ? RayTraceFluidMode.SOURCE_ONLY : RayTraceFluidMode.NEVER, false, false);
- Vec3d vec3d1 = vec3d.func_72441_c((double)f6 * 5.0D, (double)f5 * 5.0D, (double)f7 * 5.0D);
+ double d3 = p_77621_2_.func_110148_a(EntityPlayer.REACH_DISTANCE).func_111126_e();
+ Vec3d vec3d1 = vec3d.func_72441_c((double)f6 * d3, (double)f5 * d3, (double)f7 * d3);
return p_77621_1_.func_200259_a(vec3d, vec3d1, p_77621_3_ ? RayTraceFluidMode.SOURCE_ONLY : RayTraceFluidMode.NEVER, false, false);
}
@@ -297,6 +304,7 @@
}
protected boolean isInCreativeTab(ItemGroup targetTab) {
+ if (getCreativeTabs().stream().anyMatch(tab -> tab == targetTab)) return true;
ItemGroup itemgroup = this.getCreativeTab();
return itemgroup != null && (targetTab == ItemGroup.SEARCH || targetTab == itemgroup);
protected boolean func_194125_a(ItemGroup p_194125_1_) {
+ if (getCreativeTabs().stream().anyMatch(tab -> tab == p_194125_1_)) return true;
ItemGroup itemgroup = this.func_77640_w();
return itemgroup != null && (p_194125_1_ == ItemGroup.field_78027_g || p_194125_1_ == itemgroup);
}
@@ -310,10 +318,48 @@
return false;
}
+ @Deprecated // Use ItemStack sensitive version.
public Multimap<String, AttributeModifier> getItemAttributeModifiers(EntityEquipmentSlot equipmentSlot) {
public Multimap<String, AttributeModifier> func_111205_h(EntityEquipmentSlot p_111205_1_) {
return HashMultimap.<String, AttributeModifier>create();
}
@ -94,7 +94,7 @@
+ @Override
+ public boolean isRepairable()
+ {
+ return canRepair && isDamageable();
+ return canRepair && func_77645_m();
+ }
+
+ @Override
@ -114,14 +114,14 @@
+ public final net.minecraft.client.renderer.tileentity.TileEntityItemStackRenderer getTileEntityItemStackRenderer()
+ {
+ net.minecraft.client.renderer.tileentity.TileEntityItemStackRenderer renderer = teisr != null ? teisr.get() : null;
+ return renderer != null ? renderer : net.minecraft.client.renderer.tileentity.TileEntityItemStackRenderer.instance;
+ return renderer != null ? renderer : net.minecraft.client.renderer.tileentity.TileEntityItemStackRenderer.field_147719_a;
+ }
+
+ /* ======================================== FORGE END =====================================*/
+
public static void registerItems() {
registerItemBlock(Blocks.AIR, new ItemAir(Blocks.AIR, new Item.Builder()));
func_200879_a(Blocks.STONE, ItemGroup.BUILDING_BLOCKS);
public static void func_150900_l() {
func_179214_a(Blocks.field_150350_a, new ItemAir(Blocks.field_150350_a, new Item.Builder()));
func_200879_a(Blocks.field_150348_b, ItemGroup.field_78030_b);
@@ -1147,6 +1193,9 @@
private Item field_200922_c;
private ItemGroup field_200923_d;

View File

@ -2,10 +2,10 @@
+++ b/net/minecraft/item/ItemArmor.java
@@ -105,4 +105,8 @@
public int func_200881_e() {
return this.damageReduceAmount;
return this.field_77879_b;
}
+
+ public float getToughness() {
+ return this.toughness;
+ return this.field_189415_e;
+ }
}

View File

@ -1,25 +1,25 @@
--- a/net/minecraft/item/ItemPickaxe.java
+++ b/net/minecraft/item/ItemPickaxe.java
@@ -17,18 +17,11 @@
public boolean canHarvestBlock(IBlockState blockIn) {
Block block = blockIn.getBlock();
public boolean func_150897_b(IBlockState p_150897_1_) {
Block block = p_150897_1_.func_177230_c();
int i = this.func_200891_e().func_200925_d();
- if (block == Blocks.OBSIDIAN) {
- if (block == Blocks.field_150343_Z) {
- return i == 3;
- } else if (block != Blocks.DIAMOND_BLOCK && block != Blocks.DIAMOND_ORE && block != Blocks.EMERALD_ORE && block != Blocks.EMERALD_BLOCK && block != Blocks.GOLD_BLOCK && block != Blocks.GOLD_ORE && block != Blocks.REDSTONE_ORE) {
- if (block != Blocks.IRON_BLOCK && block != Blocks.IRON_ORE && block != Blocks.LAPIS_BLOCK && block != Blocks.LAPIS_ORE) {
- Material material = blockIn.getMaterial();
- return material == Material.ROCK || material == Material.IRON || material == Material.ANVIL;
- } else if (block != Blocks.field_150484_ah && block != Blocks.field_150482_ag && block != Blocks.field_150412_bA && block != Blocks.field_150475_bE && block != Blocks.field_150340_R && block != Blocks.field_150352_o && block != Blocks.field_150450_ax) {
- if (block != Blocks.field_150339_S && block != Blocks.field_150366_p && block != Blocks.field_150368_y && block != Blocks.field_150369_x) {
- Material material = p_150897_1_.func_185904_a();
- return material == Material.field_151576_e || material == Material.field_151573_f || material == Material.field_151574_g;
- } else {
- return i >= 1;
- }
- } else {
- return i >= 2;
+ if (blockIn.getHarvestTool() == net.minecraftforge.common.ToolType.PICKAXE) {
+ return i >= blockIn.getHarvestLevel();
+ if (p_150897_1_.getHarvestTool() == net.minecraftforge.common.ToolType.PICKAXE) {
+ return i >= p_150897_1_.getHarvestLevel();
}
+ Material material = blockIn.getMaterial();
+ return material == Material.ROCK || material == Material.IRON || material == Material.ANVIL;
+ Material material = p_150897_1_.func_185904_a();
+ return material == Material.field_151576_e || material == Material.field_151573_f || material == Material.field_151574_g;
}
public float getDestroySpeed(ItemStack stack, IBlockState state) {
public float func_150893_a(ItemStack p_150893_1_, IBlockState p_150893_2_) {

View File

@ -7,11 +7,11 @@
-public final class ItemStack {
+public final class ItemStack extends net.minecraftforge.common.capabilities.CapabilityProvider implements net.minecraftforge.common.extensions.IForgeItemStack {
private static final Logger field_199558_c = LogManager.getLogger();
public static final ItemStack EMPTY = new ItemStack((Item)null);
public static final DecimalFormat DECIMALFORMAT = func_208306_D();
public static final ItemStack field_190927_a = new ItemStack((Item)null);
public static final DecimalFormat field_111284_a = func_208306_D();
@@ -79,6 +79,9 @@
private BlockWorldState canPlaceOnCacheBlock;
private boolean canPlaceOnCacheResult;
private BlockWorldState field_179550_j;
private boolean field_179551_k;
+ private net.minecraftforge.registries.IRegistryDelegate<Item> delegate;
+ private NBTTagCompound capNBT;
@ -27,44 +27,44 @@
+ public ItemStack(IItemProvider p_i48204_1_, int p_i48204_2_){ this(p_i48204_1_, p_i48204_2_, null); }
+ public ItemStack(IItemProvider p_i48204_1_, int p_i48204_2_, @Nullable NBTTagCompound capNBT) {
+ this.capNBT = capNBT;
this.item = p_i48204_1_ == null ? null : p_i48204_1_.func_199767_j();
this.stackSize = p_i48204_2_;
this.updateEmptyState();
this.field_151002_e = p_i48204_1_ == null ? null : p_i48204_1_.func_199767_j();
this.field_77994_a = p_i48204_2_;
this.func_190923_F();
+ this.forgeInit();
}
private void updateEmptyState() {
private void func_190923_F() {
@@ -101,6 +107,7 @@
}
private ItemStack(NBTTagCompound compound) {
+ this.capNBT = compound.hasKey("ForgeCaps") ? compound.getCompoundTag("ForgeCaps") : null;
Item item = Item.REGISTRY.getObject(new ResourceLocation(compound.getString("id")));
this.item = item == null ? Items.AIR : item;
this.stackSize = compound.getByte("Count");
private ItemStack(NBTTagCompound p_i47263_1_) {
+ this.capNBT = p_i47263_1_.func_74764_b("ForgeCaps") ? p_i47263_1_.func_74775_l("ForgeCaps") : null;
Item item = Item.field_150901_e.func_82594_a(new ResourceLocation(p_i47263_1_.func_74779_i("id")));
this.field_151002_e = item == null ? Items.field_190931_a : item;
this.field_77994_a = p_i47263_1_.func_74771_c("Count");
@@ -114,6 +121,7 @@
}
this.updateEmptyState();
this.func_190923_F();
+ this.forgeInit();
}
public static ItemStack func_199557_a(NBTTagCompound p_199557_0_) {
@@ -128,7 +136,7 @@
public boolean isEmpty() {
if (this == EMPTY) {
public boolean func_190926_b() {
if (this == field_190927_a) {
return true;
- } else if (this.getItem() != null && this.getItem() != Items.AIR) {
+ } else if (this.getItemRaw() != null && this.getItemRaw() != Items.AIR) {
return this.stackSize <= 0;
- } else if (this.func_77973_b() != null && this.func_77973_b() != Items.field_190931_a) {
+ } else if (this.getItemRaw() != null && this.getItemRaw() != Items.field_190931_a) {
return this.field_77994_a <= 0;
} else {
return true;
@@ -144,10 +152,11 @@
}
public Item getItem() {
- return this.isEmpty ? Items.AIR : this.item;
+ return this.isEmpty || this.delegate == null ? Items.AIR : this.delegate.get();
public Item func_77973_b() {
- return this.field_190928_g ? Items.field_190931_a : this.field_151002_e;
+ return this.field_190928_g || this.delegate == null ? Items.field_190931_a : this.delegate.get();
}
public EnumActionResult func_196084_a(ItemUseContext p_196084_1_) {
@ -73,83 +73,83 @@
BlockPos blockpos = p_196084_1_.func_195995_a();
BlockWorldState blockworldstate = new BlockWorldState(p_196084_1_.func_195991_k(), blockpos, false);
@@ -183,12 +192,15 @@
if (this.stackTagCompound != null) {
nbt.setTag("tag", this.stackTagCompound);
if (this.field_77990_d != null) {
p_77955_1_.func_74782_a("tag", this.field_77990_d);
}
-
+ NBTTagCompound cnbt = this.serializeCaps();
+ if (cnbt != null && !cnbt.isEmpty()) {
+ nbt.setTag("ForgeCaps", cnbt);
+ p_77955_1_.func_74782_a("ForgeCaps", cnbt);
+ }
return nbt;
return p_77955_1_;
}
public int getMaxStackSize() {
- return this.getItem().getItemStackLimit();
+ return this.getItem().getItemStackLimit(this);
public int func_77976_d() {
- return this.func_77973_b().func_77639_j();
+ return this.func_77973_b().getItemStackLimit(this);
}
public boolean isStackable() {
public boolean func_77985_e() {
@@ -196,7 +208,7 @@
}
public boolean isItemStackDamageable() {
- if (!this.isEmpty && this.getItem().getMaxDamage() > 0) {
+ if (!this.isEmpty && this.getItem().getMaxDamage(this) > 0) {
NBTTagCompound nbttagcompound = this.getTagCompound();
return nbttagcompound == null || !nbttagcompound.getBoolean("Unbreakable");
public boolean func_77984_f() {
- if (!this.field_190928_g && this.func_77973_b().func_77612_l() > 0) {
+ if (!this.field_190928_g && this.func_77973_b().getMaxDamage(this) > 0) {
NBTTagCompound nbttagcompound = this.func_77978_p();
return nbttagcompound == null || !nbttagcompound.func_74767_n("Unbreakable");
} else {
@@ -205,7 +217,7 @@
}
public boolean isItemDamaged() {
- return this.isItemStackDamageable() && this.getItemDamage() > 0;
+ return this.isItemStackDamageable() && getItem().isDamaged(this);
public boolean func_77951_h() {
- return this.func_77984_f() && this.func_77952_i() > 0;
+ return this.func_77984_f() && func_77973_b().isDamaged(this);
}
public int getItemDamage() {
public int func_77952_i() {
@@ -217,7 +229,7 @@
}
public int getMaxDamage() {
- return this.getItem().getMaxDamage();
+ return this.getItem().getMaxDamage(this);
public int func_77958_k() {
- return this.func_77973_b().func_77612_l();
+ return this.func_77973_b().getMaxDamage(this);
}
public boolean attemptDamageItem(int amount, Random rand, @Nullable EntityPlayerMP damager) {
public boolean func_96631_a(int p_96631_1_, Random p_96631_2_, @Nullable EntityPlayerMP p_96631_3_) {
@@ -285,7 +297,7 @@
}
public boolean canHarvestBlock(IBlockState blockIn) {
- return this.getItem().canHarvestBlock(blockIn);
+ return this.getItem().canHarvestBlock(this, blockIn);
public boolean func_150998_b(IBlockState p_150998_1_) {
- return this.func_77973_b().func_150897_b(p_150998_1_);
+ return this.func_77973_b().canHarvestBlock(this, p_150998_1_);
}
public boolean interactWithEntity(EntityPlayer playerIn, EntityLivingBase entityIn, EnumHand hand) {
public boolean func_111282_a(EntityPlayer p_111282_1_, EntityLivingBase p_111282_2_, EnumHand p_111282_3_) {
@@ -293,7 +305,7 @@
}
public ItemStack copy() {
- ItemStack itemstack = new ItemStack(this.getItem(), this.stackSize);
+ ItemStack itemstack = new ItemStack(this.getItem(), this.stackSize, this.serializeCaps());
itemstack.setAnimationsToGo(this.getAnimationsToGo());
if (this.stackTagCompound != null) {
itemstack.stackTagCompound = this.stackTagCompound.copy();
public ItemStack func_77946_l() {
- ItemStack itemstack = new ItemStack(this.func_77973_b(), this.field_77994_a);
+ ItemStack itemstack = new ItemStack(this.func_77973_b(), this.field_77994_a, this.serializeCaps());
itemstack.func_190915_d(this.func_190921_D());
if (this.field_77990_d != null) {
itemstack.field_77990_d = this.field_77990_d.func_74737_b();
@@ -309,7 +321,7 @@
if (stackA.stackTagCompound == null && stackB.stackTagCompound != null) {
if (p_77970_0_.field_77990_d == null && p_77970_1_.field_77990_d != null) {
return false;
} else {
- return stackA.stackTagCompound == null || stackA.stackTagCompound.equals(stackB.stackTagCompound);
+ return stackA.stackTagCompound == null || stackA.stackTagCompound.equals(stackB.stackTagCompound) && stackA.areCapsCompatible(stackB);
- return p_77970_0_.field_77990_d == null || p_77970_0_.field_77990_d.equals(p_77970_1_.field_77990_d);
+ return p_77970_0_.field_77990_d == null || p_77970_0_.field_77990_d.equals(p_77970_1_.field_77990_d) && p_77970_0_.areCapsCompatible(p_77970_1_);
}
} else {
return false;
@@ -332,7 +344,7 @@
} else if (this.stackTagCompound == null && other.stackTagCompound != null) {
} else if (this.field_77990_d == null && p_77959_1_.field_77990_d != null) {
return false;
} else {
- return this.stackTagCompound == null || this.stackTagCompound.equals(other.stackTagCompound);
+ return this.stackTagCompound == null || this.stackTagCompound.equals(other.stackTagCompound) && this.areCapsCompatible(other);
- return this.field_77990_d == null || this.field_77990_d.equals(p_77959_1_.field_77990_d);
+ return this.field_77990_d == null || this.field_77990_d.equals(p_77959_1_.field_77990_d) && this.areCapsCompatible(p_77959_1_);
}
}
@ -157,7 +157,7 @@
}
}
+ net.minecraftforge.event.ForgeEventFactory.onItemTooltip(this, playerIn, list, advanced);
+ net.minecraftforge.event.ForgeEventFactory.onItemTooltip(this, p_82840_1_, list, p_82840_2_);
return list;
}
@ -165,21 +165,21 @@
}
}
} else {
- multimap = this.getItem().getItemAttributeModifiers(equipmentSlot);
+ multimap = this.getItem().getAttributeModifiers(equipmentSlot, this);
- multimap = this.func_77973_b().func_111205_h(p_111283_1_);
+ multimap = this.func_77973_b().getAttributeModifiers(p_111283_1_, this);
}
return multimap;
@@ -874,4 +887,89 @@
public void shrink(int quantity) {
this.grow(-quantity);
public void func_190918_g(int p_190918_1_) {
this.func_190917_f(-p_190918_1_);
}
+
+ // FORGE START
+ public void deserializeNBT(NBTTagCompound nbt)
+ {
+ final ItemStack itemStack = ItemStack.func_199557_a(nbt);
+ getStack().setTagCompound(itemStack.getTagCompound());
+ getStack().func_77982_d(itemStack.func_77978_p());
+ if (itemStack.capNBT != null) deserializeCaps(itemStack.capNBT);
+ }
+
@ -205,7 +205,7 @@
+ @Nullable
+ private Item getItemRaw()
+ {
+ return this.item;
+ return this.field_151002_e;
+ }
+
+ /**
@ -215,10 +215,10 @@
+ */
+ public static boolean areItemStacksEqualUsingNBTShareTag(ItemStack stackA, ItemStack stackB)
+ {
+ if (stackA.isEmpty())
+ return stackB.isEmpty();
+ if (stackA.func_190926_b())
+ return stackB.func_190926_b();
+ else
+ return !stackB.isEmpty() && stackA.isItemStackEqualUsingNBTShareTag(stackB);
+ return !stackB.func_190926_b() && stackA.isItemStackEqualUsingNBTShareTag(stackB);
+ }
+
+ /**
@ -228,7 +228,7 @@
+ */
+ private boolean isItemStackEqualUsingNBTShareTag(ItemStack other)
+ {
+ return this.stackSize == other.stackSize && this.getItem() == other.getItem() && areItemStackShareTagsEqual(this, other);
+ return this.field_77994_a == other.field_77994_a && this.func_77973_b() == other.func_77973_b() && areItemStackShareTagsEqual(this, other);
+ }
+
+ /**
@ -238,8 +238,8 @@
+ */
+ public static boolean areItemStackShareTagsEqual(ItemStack stackA, ItemStack stackB)
+ {
+ NBTTagCompound shareTagA = stackA.getItem().getNBTShareTag(stackA);
+ NBTTagCompound shareTagB = stackB.getItem().getNBTShareTag(stackB);
+ NBTTagCompound shareTagA = stackA.func_77973_b().getNBTShareTag(stackA);
+ NBTTagCompound shareTagB = stackB.func_77973_b().getNBTShareTag(stackB);
+ if (shareTagA == null)
+ return shareTagB == null;
+ else
@ -257,6 +257,6 @@
+ */
+ public boolean doesSneakBypassUse(net.minecraft.world.IWorldReader world, BlockPos pos, EntityPlayer player)
+ {
+ return this.isEmpty() || this.getItem().doesSneakBypassUse(this, world, pos, player);
+ return this.func_190926_b() || this.func_77973_b().doesSneakBypassUse(this, world, pos, player);
+ }
}

View File

@ -14,6 +14,6 @@
}
- @OnlyIn(Dist.CLIENT)
public boolean canFit(int width, int height) {
return width >= 3 && height >= 3;
public boolean func_194133_a(int p_194133_1_, int p_194133_2_) {
return p_194133_1_ >= 3 && p_194133_2_ >= 3;
}

View File

@ -11,20 +11,20 @@
public BannerDuplicateRecipe(ResourceLocation p_i48171_1_) {
@@ -77,8 +75,8 @@
for(int i = 0; i < nonnulllist.size(); ++i) {
ItemStack itemstack = inv.getStackInSlot(i);
if (!itemstack.isEmpty()) {
- if (itemstack.getItem().hasContainerItem()) {
- nonnulllist.set(i, new ItemStack(itemstack.getItem().getContainerItem()));
ItemStack itemstack = p_179532_1_.func_70301_a(i);
if (!itemstack.func_190926_b()) {
- if (itemstack.func_77973_b().func_77634_r()) {
- nonnulllist.set(i, new ItemStack(itemstack.func_77973_b().func_77668_q()));
+ if (itemstack.hasContainerItem()) {
+ nonnulllist.set(i, itemstack.getContainerItem());
} else if (itemstack.hasTagCompound() && TileEntityBanner.getPatterns(itemstack) > 0) {
ItemStack itemstack1 = itemstack.copy();
itemstack1.setCount(1);
} else if (itemstack.func_77942_o() && TileEntityBanner.func_175113_c(itemstack) > 0) {
ItemStack itemstack1 = itemstack.func_77946_l();
itemstack1.func_190920_e(1);
@@ -94,7 +92,6 @@
return RecipeSerializers.field_199586_l;
}
- @OnlyIn(Dist.CLIENT)
public boolean canFit(int width, int height) {
return width * height >= 2;
public boolean func_194133_a(int p_194133_1_, int p_194133_2_) {
return p_194133_1_ * p_194133_2_ >= 2;
}

View File

@ -8,12 +8,12 @@
-import net.minecraftforge.api.distmarker.OnlyIn;
public class FireworkRocketRecipe extends IRecipeHidden {
private static final Ingredient field_196209_a = Ingredient.func_199804_a(Items.PAPER);
private static final Ingredient field_196209_a = Ingredient.func_199804_a(Items.field_151121_aF);
@@ -80,7 +78,6 @@
return itemstack;
}
- @OnlyIn(Dist.CLIENT)
public boolean canFit(int width, int height) {
return width * height >= 2;
public boolean func_194133_a(int p_194133_1_, int p_194133_2_) {
return p_194133_1_ * p_194133_2_ >= 2;
}

View File

@ -14,6 +14,6 @@
}
- @OnlyIn(Dist.CLIENT)
public boolean canFit(int width, int height) {
return width * height >= 2;
public boolean func_194133_a(int p_194133_1_, int p_194133_2_) {
return p_194133_1_ * p_194133_2_ >= 2;
}

View File

@ -8,12 +8,12 @@
-import net.minecraftforge.api.distmarker.OnlyIn;
public class FireworkStarRecipe extends IRecipeHidden {
private static final Ingredient field_196212_a = Ingredient.func_199804_a(Items.FIRE_CHARGE, Items.FEATHER, Items.GOLD_NUGGET, Items.field_196182_dv, Items.field_196183_dw, Items.field_196185_dy, Items.field_196184_dx, Items.field_196151_dA, Items.field_196186_dz);
private static final Ingredient field_196212_a = Ingredient.func_199804_a(Items.field_151059_bz, Items.field_151008_G, Items.field_151074_bl, Items.field_196182_dv, Items.field_196183_dw, Items.field_196185_dy, Items.field_196184_dx, Items.field_196151_dA, Items.field_196186_dz);
@@ -116,7 +114,6 @@
return itemstack;
}
- @OnlyIn(Dist.CLIENT)
public boolean canFit(int width, int height) {
return width * height >= 2;
public boolean func_194133_a(int p_194133_1_, int p_194133_2_) {
return p_194133_1_ * p_194133_2_ >= 2;
}

View File

@ -10,11 +10,11 @@
public class FurnaceRecipe implements IRecipe {
private final ResourceLocation field_201832_a;
@@ -38,7 +36,6 @@
return this.field_201835_d.copy();
return this.field_201835_d.func_77946_l();
}
- @OnlyIn(Dist.CLIENT)
public boolean canFit(int width, int height) {
public boolean func_194133_a(int p_194133_1_, int p_194133_2_) {
return true;
}
@@ -61,7 +58,6 @@
@ -22,7 +22,7 @@
}
- @OnlyIn(Dist.CLIENT)
public String getGroup() {
public String func_193358_e() {
return this.field_201833_b;
}
@@ -75,6 +71,7 @@
@ -31,10 +31,10 @@
public static class Serializer implements IRecipeSerializer<FurnaceRecipe> {
+ private static ResourceLocation NAME = new ResourceLocation("minecraft", "smelting");
public FurnaceRecipe func_199425_a_(ResourceLocation p_199425_1_, JsonObject p_199425_2_) {
String s = JsonUtils.getString(p_199425_2_, "group", "");
String s = JsonUtils.func_151219_a(p_199425_2_, "group", "");
Ingredient ingredient;
@@ -113,8 +110,9 @@
p_199427_1_.writeVarInt(p_199427_2_.field_201837_f);
p_199427_1_.func_150787_b(p_199427_2_.field_201837_f);
}
- public String func_199567_a() {

View File

@ -13,22 +13,23 @@
-import net.minecraftforge.api.distmarker.OnlyIn;
public interface IRecipe {
boolean matches(IInventory inv, World worldIn);
boolean func_77569_a(IInventory p_77569_1_, World p_77569_2_);
ItemStack getCraftingResult(IInventory inv);
ItemStack func_77572_b(IInventory p_77572_1_);
- @OnlyIn(Dist.CLIENT)
boolean canFit(int width, int height);
boolean func_194133_a(int p_194133_1_, int p_194133_2_);
ItemStack getRecipeOutput();
ItemStack func_77571_b();
@@ -23,9 +19,9 @@
NonNullList<ItemStack> nonnulllist = NonNullList.<ItemStack>withSize(inv.getSizeInventory(), ItemStack.EMPTY);
NonNullList<ItemStack> nonnulllist = NonNullList.<ItemStack>func_191197_a(p_179532_1_.func_70302_i_(), ItemStack.field_190927_a);
for(int i = 0; i < nonnulllist.size(); ++i) {
- Item item = inv.getStackInSlot(i).getItem();
+ ItemStack item = inv.getStackInSlot(i);
if (item.hasContainerItem()) {
- nonnulllist.set(i, new ItemStack(item.getContainerItem()));
- Item item = p_179532_1_.func_70301_a(i).func_77973_b();
- if (item.func_77634_r()) {
- nonnulllist.set(i, new ItemStack(item.func_77668_q()));
+ ItemStack item = p_179532_1_.func_70301_a(i);
+ if (item.hasContainerItem()) {
+ nonnulllist.set(i, item.getContainerItem());
}
}
@ -38,6 +39,6 @@
}
- @OnlyIn(Dist.CLIENT)
default String getGroup() {
default String func_193358_e() {
return "";
}

View File

@ -8,7 +8,7 @@
+ @Deprecated //Modders, do not use, this is un-namespaced and thus could cause clashes.
+ default String func_199567_a() {
+ ResourceLocation name = getName(); //To keep compatibility with vanilla, anything in the "minecraft" namespace doesn't get a prefix.
+ return name.getNamespace().equals("minecraft") ? name.getPath() : name.toString();
+ return name.func_110624_b().equals("minecraft") ? name.func_110623_a() : name.toString();
+ }
+
+ ResourceLocation getName();

View File

@ -15,26 +15,26 @@
+ }
+
private static final Predicate<? super Ingredient.IItemList> field_209362_b = (p_209361_0_) -> {
return !p_209361_0_.func_199799_a().stream().allMatch(ItemStack::isEmpty);
return !p_209361_0_.func_199799_a().stream().allMatch(ItemStack::func_190926_b);
};
@@ -36,14 +40,16 @@
private final Ingredient.IItemList[] field_199807_b;
private ItemStack[] matchingStacks;
private IntList matchingStacksPacked;
private ItemStack[] field_193371_b;
private IntList field_194140_c;
+ private final boolean isSimple;
protected Ingredient(Stream<? extends Ingredient.IItemList> p_i49381_1_) {
this.field_199807_b = (Ingredient.IItemList[])p_i49381_1_.filter(field_209362_b).toArray((p_209360_0_) -> {
return new Ingredient.IItemList[p_209360_0_];
});
+ this.isSimple = !Arrays.stream(field_199807_b).anyMatch(list -> list.func_199799_a().stream().anyMatch(stack -> stack.getItem().isDamageable()));
+ this.isSimple = !Arrays.stream(field_199807_b).anyMatch(list -> list.func_199799_a().stream().anyMatch(stack -> stack.func_77973_b().func_77645_m()));
+ Ingredient.INSTANCES.add(this);
}
- @OnlyIn(Dist.CLIENT)
public ItemStack[] getMatchingStacks() {
public ItemStack[] func_193365_a() {
this.func_199806_d();
return this.matchingStacks;
return this.field_193371_b;
@@ -95,6 +101,10 @@
public final void func_199564_a(PacketBuffer p_199564_1_) {
@ -43,20 +43,20 @@
+ net.minecraftforge.common.crafting.CraftingHelper.write(p_199564_1_, this);
+ return;
+ }
p_199564_1_.writeVarInt(this.matchingStacks.length);
p_199564_1_.func_150787_b(this.field_193371_b.length);
for(int i = 0; i < this.matchingStacks.length; ++i) {
for(int i = 0; i < this.field_193371_b.length; ++i) {
@@ -121,6 +131,25 @@
return this.field_199807_b.length == 0 && (this.matchingStacks == null || this.matchingStacks.length == 0) && (this.matchingStacksPacked == null || this.matchingStacksPacked.isEmpty());
return this.field_199807_b.length == 0 && (this.field_193371_b == null || this.field_193371_b.length == 0) && (this.field_194140_c == null || this.field_194140_c.isEmpty());
}
+ protected void invalidate() {
+ this.matchingStacks = null;
+ this.matchingStacksPacked = null;
+ this.field_193371_b = null;
+ this.field_194140_c = null;
+ }
+
+ public boolean isSimple() {
+ return isSimple || this == EMPTY;
+ return isSimple || this == field_193370_a;
+ }
+
+ private final boolean isVanilla = this.getClass() == Ingredient.class;
@ -71,27 +71,27 @@
+
public static Ingredient func_209357_a(Stream<? extends Ingredient.IItemList> p_209357_0_) {
Ingredient ingredient = new Ingredient(p_209357_0_);
return ingredient.field_199807_b.length == 0 ? EMPTY : ingredient;
return ingredient.field_199807_b.length == 0 ? field_193370_a : ingredient;
@@ -132,7 +161,6 @@
}));
}
- @OnlyIn(Dist.CLIENT)
public static Ingredient fromStacks(ItemStack... stacks) {
return func_209357_a(Arrays.stream(stacks).map((p_209356_0_) -> {
public static Ingredient func_193369_a(ItemStack... p_193369_0_) {
return func_209357_a(Arrays.stream(p_193369_0_).map((p_209356_0_) -> {
return new Ingredient.SingleItemList(p_209356_0_);
@@ -144,7 +172,12 @@
}
public static Ingredient func_199566_b(PacketBuffer p_199566_0_) {
+ p_199566_0_.markReaderIndex();
int i = p_199566_0_.readVarInt();
int i = p_199566_0_.func_150792_a();
+ if (i == -1) {
+ p_199566_0_.resetReaderIndex();
+ return net.minecraftforge.common.crafting.CraftingHelper.getIngredient(p_199566_0_.readResourceLocation(), p_199566_0_);
+ return net.minecraftforge.common.crafting.CraftingHelper.getIngredient(p_199566_0_.func_192575_l(), p_199566_0_);
+ }
return func_209357_a(Stream.generate(() -> {
return new Ingredient.SingleItemList(p_199566_0_.readItemStack());
return new Ingredient.SingleItemList(p_199566_0_.func_150791_c());
}).limit((long)i));
@@ -152,6 +185,8 @@
@ -107,8 +107,8 @@
public static Ingredient.IItemList func_199803_a(JsonObject p_199803_0_) {
+ if (p_199803_0_.has("constant")) {
+ Ingredient.IItemList ret = net.minecraftforge.common.crafting.CraftingHelper.getConstant(new ResourceLocation(JsonUtils.getString(p_199803_0_, "constant")));
+ if (ret == null) throw new JsonSyntaxException("Ingredient referenced invalid constant: " + JsonUtils.getString(p_199803_0_, "constant"));
+ Ingredient.IItemList ret = net.minecraftforge.common.crafting.CraftingHelper.getConstant(new ResourceLocation(JsonUtils.func_151200_h(p_199803_0_, "constant")));
+ if (ret == null) throw new JsonSyntaxException("Ingredient referenced invalid constant: " + JsonUtils.func_151200_h(p_199803_0_, "constant"));
+ return ret;
+ }
if (p_199803_0_.has("item") && p_199803_0_.has("tag")) {

View File

@ -12,19 +12,19 @@
@@ -86,8 +84,8 @@
for(int i = 0; i < nonnulllist.size(); ++i) {
ItemStack itemstack = inv.getStackInSlot(i);
- if (itemstack.getItem().hasContainerItem()) {
- nonnulllist.set(i, new ItemStack(itemstack.getItem().getContainerItem()));
ItemStack itemstack = p_179532_1_.func_70301_a(i);
- if (itemstack.func_77973_b().func_77634_r()) {
- nonnulllist.set(i, new ItemStack(itemstack.func_77973_b().func_77668_q()));
+ if (itemstack.hasContainerItem()) {
+ nonnulllist.set(i, itemstack.getContainerItem());
} else if (itemstack.getItem() instanceof ItemWrittenBook) {
ItemStack itemstack1 = itemstack.copy();
itemstack1.setCount(1);
} else if (itemstack.func_77973_b() instanceof ItemWrittenBook) {
ItemStack itemstack1 = itemstack.func_77946_l();
itemstack1.func_190920_e(1);
@@ -103,7 +101,6 @@
return RecipeSerializers.field_199578_d;
}
- @OnlyIn(Dist.CLIENT)
public boolean canFit(int width, int height) {
return width >= 3 && height >= 3;
public boolean func_194133_a(int p_194133_1_, int p_194133_2_) {
return p_194133_1_ >= 3 && p_194133_2_ >= 3;
}

View File

@ -10,10 +10,10 @@
return p_199516_0_.endsWith(".json");
})) {
@@ -47,6 +49,8 @@
JsonObject jsonobject = (JsonObject)JsonUtils.gsonDeserialize(gson, IOUtils.toString(iresource.func_199027_b(), StandardCharsets.UTF_8), JsonObject.class);
JsonObject jsonobject = (JsonObject)JsonUtils.func_188178_a(gson, IOUtils.toString(iresource.func_199027_b(), StandardCharsets.UTF_8), JsonObject.class);
if (jsonobject == null) {
field_199521_c.error("Couldn't load recipe {} as it's null or empty", (Object)resourcelocation1);
+ } else if (jsonobject.has("conditions") && !net.minecraftforge.common.crafting.CraftingHelper.processConditions(JsonUtils.getJsonArray(jsonobject, "conditions"))) {
+ } else if (jsonobject.has("conditions") && !net.minecraftforge.common.crafting.CraftingHelper.processConditions(JsonUtils.func_151214_t(jsonobject, "conditions"))) {
+ field_199521_c.info("Skipping loading recipe {} as it's conditions were not met", resourcelocation1);
} else {
this.func_199509_a(RecipeSerializers.func_199572_a(resourcelocation1, jsonobject));

View File

@ -16,24 +16,24 @@
@@ -59,11 +56,10 @@
ItemStack itemstack3 = list.get(0);
ItemStack itemstack4 = list.get(1);
if (itemstack3.getItem() == itemstack4.getItem() && itemstack3.getCount() == 1 && itemstack4.getCount() == 1 && itemstack3.getItem().isDamageable()) {
- Item item = itemstack3.getItem();
- int j = item.getMaxDamage() - itemstack3.getItemDamage();
- int k = item.getMaxDamage() - itemstack4.getItemDamage();
- int l = j + k + item.getMaxDamage() * 5 / 100;
- int i1 = item.getMaxDamage() - l;
+ int j = itemstack3.getMaxDamage() - itemstack3.getItemDamage();
+ int k = itemstack3.getMaxDamage() - itemstack4.getItemDamage();
+ int l = j + k + itemstack3.getMaxDamage() * 5 / 100;
+ int i1 = itemstack3.getMaxDamage() - l;
if (itemstack3.func_77973_b() == itemstack4.func_77973_b() && itemstack3.func_190916_E() == 1 && itemstack4.func_190916_E() == 1 && itemstack3.func_77973_b().func_77645_m()) {
- Item item = itemstack3.func_77973_b();
- int j = item.func_77612_l() - itemstack3.func_77952_i();
- int k = item.func_77612_l() - itemstack4.func_77952_i();
- int l = j + k + item.func_77612_l() * 5 / 100;
- int i1 = item.func_77612_l() - l;
+ int j = itemstack3.func_77958_k() - itemstack3.func_77952_i();
+ int k = itemstack3.func_77958_k() - itemstack4.func_77952_i();
+ int l = j + k + itemstack3.func_77958_k() * 5 / 100;
+ int i1 = itemstack3.func_77958_k() - l;
if (i1 < 0) {
i1 = 0;
}
@@ -77,7 +73,6 @@
return ItemStack.EMPTY;
return ItemStack.field_190927_a;
}
- @OnlyIn(Dist.CLIENT)
public boolean canFit(int width, int height) {
return width * height >= 2;
public boolean func_194133_a(int p_194133_1_, int p_194133_2_) {
return p_194133_1_ * p_194133_2_ >= 2;
}

View File

@ -28,17 +28,17 @@
}
public static IRecipe func_199572_a(ResourceLocation p_199572_0_, JsonObject p_199572_1_) {
- String s = JsonUtils.getString(p_199572_1_, "type");
+ ResourceLocation s = new ResourceLocation(JsonUtils.getString(p_199572_1_, "type"));
- String s = JsonUtils.func_151200_h(p_199572_1_, "type");
+ ResourceLocation s = new ResourceLocation(JsonUtils.func_151200_h(p_199572_1_, "type"));
IRecipeSerializer<?> irecipeserializer = field_199590_p.get(s);
if (irecipeserializer == null) {
throw new JsonSyntaxException("Invalid or unsupported recipe type '" + s + "'");
@@ -49,7 +50,7 @@
public static IRecipe func_199571_a(PacketBuffer p_199571_0_) {
ResourceLocation resourcelocation = p_199571_0_.readResourceLocation();
- String s = p_199571_0_.readString(32767);
+ ResourceLocation s = new ResourceLocation(p_199571_0_.readString(32767));
ResourceLocation resourcelocation = p_199571_0_.func_192575_l();
- String s = p_199571_0_.func_150789_c(32767);
+ ResourceLocation s = new ResourceLocation(p_199571_0_.func_150789_c(32767));
IRecipeSerializer<?> irecipeserializer = field_199590_p.get(s);
if (irecipeserializer == null) {
throw new IllegalArgumentException("Unknown recipe serializer " + s);

View File

@ -14,6 +14,6 @@
}
- @OnlyIn(Dist.CLIENT)
public boolean canFit(int width, int height) {
return width >= 2 && height >= 2;
public boolean func_194133_a(int p_194133_1_, int p_194133_2_) {
return p_194133_1_ >= 2 && p_194133_2_ >= 2;
}

View File

@ -13,8 +13,8 @@
itemstack = itemstack1;
} else {
- if (!(itemstack1.getItem() instanceof ItemDye)) {
+ if (!itemstack1.getItem().func_206844_a(net.minecraftforge.common.Tags.Items.DYES)) {
- if (!(itemstack1.func_77973_b() instanceof ItemDye)) {
+ if (!itemstack1.func_77973_b().func_206844_a(net.minecraftforge.common.Tags.Items.DYES)) {
return false;
}
@ -25,11 +25,11 @@
- if (!(item instanceof ItemDye)) {
+ net.minecraft.item.EnumDyeColor color = net.minecraft.item.EnumDyeColor.getColor(itemstack1);
+ if (color == null) {
return ItemStack.EMPTY;
return ItemStack.field_190927_a;
}
- float[] afloat = ((ItemDye)item).func_195962_g().getColorComponentValues();
+ float[] afloat = color.getColorComponentValues();
- float[] afloat = ((ItemDye)item).func_195962_g().func_193349_f();
+ float[] afloat = color.func_193349_f();
int l1 = (int)(afloat[0] * 255.0F);
int i2 = (int)(afloat[1] * 255.0F);
int k2 = (int)(afloat[2] * 255.0F);
@ -38,6 +38,6 @@
}
- @OnlyIn(Dist.CLIENT)
public boolean canFit(int width, int height) {
return width * height >= 2;
public boolean func_194133_a(int p_194133_1_, int p_194133_2_) {
return p_194133_1_ * p_194133_2_ >= 2;
}

View File

@ -14,6 +14,6 @@
}
- @OnlyIn(Dist.CLIENT)
public boolean canFit(int width, int height) {
return width >= 3 && height >= 3;
public boolean func_194133_a(int p_194133_1_, int p_194133_2_) {
return p_194133_1_ >= 3 && p_194133_2_ >= 3;
}

View File

@ -22,50 +22,50 @@
+ if (MAX_HEIGHT < height) MAX_HEIGHT = height;
+ }
+
private final int recipeWidth;
private final int recipeHeight;
private final NonNullList<Ingredient> recipeItems;
private final int field_77576_b;
private final int field_77577_c;
private final NonNullList<Ingredient> field_77574_d;
@@ -48,7 +59,6 @@
return RecipeSerializers.field_199575_a;
}
- @OnlyIn(Dist.CLIENT)
public String getGroup() {
return this.group;
public String func_193358_e() {
return this.field_194137_e;
}
@@ -61,7 +71,6 @@
return this.recipeItems;
return this.field_77574_d;
}
- @OnlyIn(Dist.CLIENT)
public boolean canFit(int width, int height) {
return width >= this.recipeWidth && height >= this.recipeHeight;
public boolean func_194133_a(int p_194133_1_, int p_194133_2_) {
return p_194133_1_ >= this.field_77576_b && p_194133_2_ >= this.field_77577_c;
}
@@ -117,10 +126,20 @@
return this.recipeWidth;
return this.field_77576_b;
}
+ @Override
+ public int getRecipeWidth() {
+ return getWidth();
+ return func_192403_f();
+ }
+
public int getHeight() {
return this.recipeHeight;
public int func_192404_g() {
return this.field_77577_c;
}
+ @Override
+ public int getRecipeHeight() {
+ return getHeight();
+ return func_192404_g();
+ }
+
private static NonNullList<Ingredient> deserializeIngredients(String[] pattern, Map<String, Ingredient> keys, int patternWidth, int patternHeight) {
NonNullList<Ingredient> nonnulllist = NonNullList.<Ingredient>withSize(patternWidth * patternHeight, Ingredient.EMPTY);
Set<String> set = Sets.newHashSet(keys.keySet());
private static NonNullList<Ingredient> func_192402_a(String[] p_192402_0_, Map<String, Ingredient> p_192402_1_, int p_192402_2_, int p_192402_3_) {
NonNullList<Ingredient> nonnulllist = NonNullList.<Ingredient>func_191197_a(p_192402_2_ * p_192402_3_, Ingredient.field_193370_a);
Set<String> set = Sets.newHashSet(p_192402_1_.keySet());
@@ -202,15 +221,15 @@
private static String[] patternFromJson(JsonArray jsonArr) {
String[] astring = new String[jsonArr.size()];
private static String[] func_192407_a(JsonArray p_192407_0_) {
String[] astring = new String[p_192407_0_.size()];
- if (astring.length > 3) {
- throw new JsonSyntaxException("Invalid pattern: too many rows, 3 is maximum");
+ if (astring.length > MAX_HEIGHT) {
@ -74,7 +74,7 @@
throw new JsonSyntaxException("Invalid pattern: empty pattern not allowed");
} else {
for(int i = 0; i < astring.length; ++i) {
String s = JsonUtils.getString(jsonArr.get(i), "pattern[" + i + "]");
String s = JsonUtils.func_151206_a(p_192407_0_.get(i), "pattern[" + i + "]");
- if (s.length() > 3) {
- throw new JsonSyntaxException("Invalid pattern: too many columns, 3 is maximum");
+ if (s.length() > MAX_WIDTH) {
@ -88,8 +88,8 @@
public static class Serializer implements IRecipeSerializer<ShapedRecipe> {
+ private static final ResourceLocation NAME = new ResourceLocation("minecraft", "crafting_shaped");
public ShapedRecipe func_199425_a_(ResourceLocation p_199425_1_, JsonObject p_199425_2_) {
String s = JsonUtils.getString(p_199425_2_, "group", "");
Map<String, Ingredient> map = ShapedRecipe.deserializeKey(JsonUtils.getJsonObject(p_199425_2_, "key"));
String s = JsonUtils.func_151219_a(p_199425_2_, "group", "");
Map<String, Ingredient> map = ShapedRecipe.func_192408_a(JsonUtils.func_152754_s(p_199425_2_, "key"));
@@ -268,8 +288,9 @@
return new ShapedRecipe(p_199425_1_, s, i, j, nonnulllist, itemstack);
}

View File

@ -9,16 +9,16 @@
public class ShapelessRecipe implements IRecipe {
private final ResourceLocation field_199562_a;
private final String group;
private final ItemStack recipeOutput;
private final NonNullList<Ingredient> recipeItems;
private final String field_194138_c;
private final ItemStack field_77580_a;
private final NonNullList<Ingredient> field_77579_b;
+ private final boolean isSimple;
public ShapelessRecipe(ResourceLocation p_i48161_1_, String p_i48161_2_, ItemStack p_i48161_3_, NonNullList<Ingredient> p_i48161_4_) {
this.field_199562_a = p_i48161_1_;
this.group = p_i48161_2_;
this.recipeOutput = p_i48161_3_;
this.recipeItems = p_i48161_4_;
this.field_194138_c = p_i48161_2_;
this.field_77580_a = p_i48161_3_;
this.field_77579_b = p_i48161_4_;
+ this.isSimple = p_i48161_4_.stream().allMatch(Ingredient::isSimple);
}
@ -28,8 +28,8 @@
}
- @OnlyIn(Dist.CLIENT)
public String getGroup() {
return this.group;
public String func_193358_e() {
return this.field_194138_c;
}
@@ -54,6 +53,7 @@
return false;
@ -38,38 +38,38 @@
+ java.util.List<ItemStack> inputs = new java.util.ArrayList<>();
int i = 0;
for(int j = 0; j < inv.getHeight(); ++j) {
for(int j = 0; j < p_77569_1_.func_174923_h(); ++j) {
@@ -61,12 +61,15 @@
ItemStack itemstack = inv.getStackInSlot(k + j * inv.getWidth());
if (!itemstack.isEmpty()) {
ItemStack itemstack = p_77569_1_.func_70301_a(k + j * p_77569_1_.func_174922_i());
if (!itemstack.func_190926_b()) {
++i;
+ if (isSimple)
recipeitemhelper.accountStack(new ItemStack(itemstack.getItem()));
recipeitemhelper.func_194112_a(new ItemStack(itemstack.func_77973_b()));
+ else
+ inputs.add(itemstack);
}
}
}
- return i == this.recipeItems.size() && recipeitemhelper.canCraft(this, (IntList)null);
+ return i == this.recipeItems.size() && (isSimple ? recipeitemhelper.canCraft(this, (IntList)null) : net.minecraftforge.common.util.RecipeMatcher.findMatches(inputs, this.recipeItems) != null);
- return i == this.field_77579_b.size() && recipeitemhelper.func_194116_a(this, (IntList)null);
+ return i == this.field_77579_b.size() && (isSimple ? recipeitemhelper.func_194116_a(this, (IntList)null) : net.minecraftforge.common.util.RecipeMatcher.findMatches(inputs, this.field_77579_b) != null);
}
}
@@ -74,19 +77,19 @@
return this.recipeOutput.copy();
return this.field_77580_a.func_77946_l();
}
- @OnlyIn(Dist.CLIENT)
public boolean canFit(int width, int height) {
return width * height >= this.recipeItems.size();
public boolean func_194133_a(int p_194133_1_, int p_194133_2_) {
return p_194133_1_ * p_194133_2_ >= this.field_77579_b.size();
}
public static class Serializer implements IRecipeSerializer<ShapelessRecipe> {
+ private static final ResourceLocation NAME = new ResourceLocation("minecraft", "crafting_shapeless");
public ShapelessRecipe func_199425_a_(ResourceLocation p_199425_1_, JsonObject p_199425_2_) {
String s = JsonUtils.getString(p_199425_2_, "group", "");
NonNullList<Ingredient> nonnulllist = func_199568_a(JsonUtils.getJsonArray(p_199425_2_, "ingredients"));
String s = JsonUtils.func_151219_a(p_199425_2_, "group", "");
NonNullList<Ingredient> nonnulllist = func_199568_a(JsonUtils.func_151214_t(p_199425_2_, "ingredients"));
if (nonnulllist.isEmpty()) {
throw new JsonParseException("No ingredients for shapeless recipe");
- } else if (nonnulllist.size() > 9) {
@ -77,7 +77,7 @@
+ } else if (nonnulllist.size() > ShapedRecipe.MAX_WIDTH * ShapedRecipe.MAX_HEIGHT) {
+ throw new JsonParseException("Too many ingredients for shapeless recipe the max is " + (ShapedRecipe.MAX_WIDTH * ShapedRecipe.MAX_HEIGHT));
} else {
ItemStack itemstack = ShapedRecipe.func_199798_a(JsonUtils.getJsonObject(p_199425_2_, "result"));
ItemStack itemstack = ShapedRecipe.func_199798_a(JsonUtils.func_152754_s(p_199425_2_, "result"));
return new ShapelessRecipe(p_199425_1_, s, itemstack, nonnulllist);
@@ -106,8 +109,9 @@
return nonnulllist;

View File

@ -14,6 +14,6 @@
}
- @OnlyIn(Dist.CLIENT)
public boolean canFit(int width, int height) {
return width * height >= 2;
public boolean func_194133_a(int p_194133_1_, int p_194133_2_) {
return p_194133_1_ * p_194133_2_ >= 2;
}

View File

@ -10,26 +10,26 @@
public class ShulkerBoxColoringRecipe extends IRecipeHidden {
public ShulkerBoxColoringRecipe(ResourceLocation p_i48159_1_) {
@@ -31,7 +29,7 @@
if (Block.getBlockFromItem(itemstack.getItem()) instanceof BlockShulkerBox) {
if (Block.func_149634_a(itemstack.func_77973_b()) instanceof BlockShulkerBox) {
++i;
} else {
- if (!(itemstack.getItem() instanceof ItemDye)) {
+ if (!itemstack.getItem().func_206844_a(net.minecraftforge.common.Tags.Items.DYES)) {
- if (!(itemstack.func_77973_b() instanceof ItemDye)) {
+ if (!itemstack.func_77973_b().func_206844_a(net.minecraftforge.common.Tags.Items.DYES)) {
return false;
}
@@ -50,7 +48,7 @@
public ItemStack getCraftingResult(IInventory inv) {
ItemStack itemstack = ItemStack.EMPTY;
public ItemStack func_77572_b(IInventory p_77572_1_) {
ItemStack itemstack = ItemStack.field_190927_a;
- ItemDye itemdye = (ItemDye)Items.field_196106_bc;
+ net.minecraft.item.EnumDyeColor color = net.minecraft.item.EnumDyeColor.WHITE;
for(int i = 0; i < inv.getSizeInventory(); ++i) {
ItemStack itemstack1 = inv.getStackInSlot(i);
for(int i = 0; i < p_77572_1_.func_70302_i_(); ++i) {
ItemStack itemstack1 = p_77572_1_.func_70301_a(i);
@@ -58,13 +56,14 @@
Item item = itemstack1.getItem();
if (Block.getBlockFromItem(item) instanceof BlockShulkerBox) {
Item item = itemstack1.func_77973_b();
if (Block.func_149634_a(item) instanceof BlockShulkerBox) {
itemstack = itemstack1;
- } else if (item instanceof ItemDye) {
- itemdye = (ItemDye)item;
@ -40,16 +40,16 @@
}
}
- ItemStack itemstack2 = BlockShulkerBox.getColoredItemStack(itemdye.func_195962_g());
+ ItemStack itemstack2 = BlockShulkerBox.getColoredItemStack(color);
if (itemstack.hasTagCompound()) {
itemstack2.setTagCompound(itemstack.getTagCompound().copy());
- ItemStack itemstack2 = BlockShulkerBox.func_190953_b(itemdye.func_195962_g());
+ ItemStack itemstack2 = BlockShulkerBox.func_190953_b(color);
if (itemstack.func_77942_o()) {
itemstack2.func_77982_d(itemstack.func_77978_p().func_74737_b());
}
@@ -72,7 +71,6 @@
return itemstack2;
}
- @OnlyIn(Dist.CLIENT)
public boolean canFit(int width, int height) {
return width * height >= 2;
public boolean func_194133_a(int p_194133_1_, int p_194133_2_) {
return p_194133_1_ * p_194133_2_ >= 2;
}

View File

@ -3,8 +3,8 @@
@@ -1265,5 +1265,7 @@
}
public void processCustomPayload(CPacketCustomPayload packetIn) {
+ PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.player.getServerWorld());
+ net.minecraftforge.fml.network.NetworkHooks.onCustomPayload(packetIn, this.netManager);
public void func_147349_a(CPacketCustomPayload p_147349_1_) {
+ PacketThreadUtil.func_180031_a(p_147349_1_, this, this.field_147369_b.func_71121_q());
+ net.minecraftforge.fml.network.NetworkHooks.onCustomPayload(p_147349_1_, this.field_147371_a);
}
}

View File

@ -6,14 +6,14 @@
+ public Channel channel()
+ {
+ return channel;
+ return field_150746_k;
+ }
+
+ public EnumPacketDirection getDirection()
+ {
+ return this.direction;
+ return this.field_179294_g;
+ }
+
static class QueuedPacket {
private final Packet<?> packet;
private final Packet<?> field_150774_a;
@Nullable

View File

@ -2,34 +2,34 @@
+++ b/net/minecraft/network/ServerStatusResponse.java
@@ -26,6 +26,7 @@
public void setServerDescription(ITextComponent descriptionIn) {
this.description = descriptionIn;
public void func_151315_a(ITextComponent p_151315_1_) {
this.field_151326_a = p_151315_1_;
+ invalidateJson();
}
public ServerStatusResponse.Players getPlayers() {
public ServerStatusResponse.Players func_151318_b() {
@@ -34,6 +35,7 @@
public void setPlayers(ServerStatusResponse.Players playersIn) {
this.players = playersIn;
public void func_151319_a(ServerStatusResponse.Players p_151319_1_) {
this.field_151324_b = p_151319_1_;
+ invalidateJson();
}
public ServerStatusResponse.Version getVersion() {
public ServerStatusResponse.Version func_151322_c() {
@@ -42,16 +44,51 @@
public void setVersion(ServerStatusResponse.Version versionIn) {
this.version = versionIn;
public void func_151321_a(ServerStatusResponse.Version p_151321_1_) {
this.field_151325_c = p_151321_1_;
+ invalidateJson();
}
public void setFavicon(String faviconBlob) {
this.favicon = faviconBlob;
public void func_151320_a(String p_151320_1_) {
this.field_151323_d = p_151320_1_;
+ invalidateJson();
}
public String getFavicon() {
return this.favicon;
public String func_151316_d() {
return this.field_151323_d;
}
+ private java.util.concurrent.Semaphore mutex = new java.util.concurrent.Semaphore(1);
@ -49,7 +49,7 @@
+ mutex.acquireUninterruptibly();
+ ret = this.json;
+ if (ret == null) {
+ ret = net.minecraft.network.status.server.SPacketServerInfo.GSON.toJson(this);
+ ret = net.minecraft.network.status.server.SPacketServerInfo.field_149297_a.toJson(this);
+ this.json = ret;
+ }
+ mutex.release();
@ -66,5 +66,5 @@
+ }
+
public static class Players {
private final int maxPlayers;
private final int onlinePlayerCount;
private final int field_151336_a;
private final int field_151334_b;

View File

@ -1,31 +1,31 @@
--- a/net/minecraft/network/handshake/client/CPacketHandshake.java
+++ b/net/minecraft/network/handshake/client/CPacketHandshake.java
@@ -13,6 +13,7 @@
private String ip;
private int port;
private EnumConnectionState requestedState;
private String field_149598_b;
private int field_149599_c;
private EnumConnectionState field_149597_d;
+ private String fmlVersion = net.minecraftforge.fml.network.NetworkHooks.NETVERSION;
public CPacketHandshake() {
}
@@ -30,11 +31,13 @@
this.ip = buf.readString(255);
this.port = buf.readUnsignedShort();
this.requestedState = EnumConnectionState.getById(buf.readVarInt());
+ this.fmlVersion = net.minecraftforge.fml.network.NetworkHooks.getFMLVersion(this.ip);
+ this.ip = this.ip.split("\0")[0];
this.field_149598_b = p_148837_1_.func_150789_c(255);
this.field_149599_c = p_148837_1_.readUnsignedShort();
this.field_149597_d = EnumConnectionState.func_150760_a(p_148837_1_.func_150792_a());
+ this.fmlVersion = net.minecraftforge.fml.network.NetworkHooks.getFMLVersion(this.field_149598_b);
+ this.field_149598_b = this.field_149598_b.split("\0")[0];
}
public void writePacketData(PacketBuffer buf) throws IOException {
buf.writeVarInt(this.protocolVersion);
- buf.writeString(this.ip);
+ buf.writeString(this.ip + "\0"+net.minecraftforge.fml.network.NetworkHooks.NETVERSION+"\0");
buf.writeShort(this.port);
buf.writeVarInt(this.requestedState.getId());
public void func_148840_b(PacketBuffer p_148840_1_) throws IOException {
p_148840_1_.func_150787_b(this.field_149600_a);
- p_148840_1_.func_180714_a(this.field_149598_b);
+ p_148840_1_.func_180714_a(this.field_149598_b + "\0"+net.minecraftforge.fml.network.NetworkHooks.NETVERSION+"\0");
p_148840_1_.writeShort(this.field_149599_c);
p_148840_1_.func_150787_b(this.field_149597_d.func_150759_c());
}
@@ -50,4 +53,8 @@
public int getProtocolVersion() {
return this.protocolVersion;
public int func_149595_d() {
return this.field_149600_a;
}
+
+ public String getFMLVersion() {

View File

@ -8,5 +8,5 @@
+public class CPacketCustomPayload implements Packet<INetHandlerPlayServer>, net.minecraftforge.fml.network.ICustomPacket<CPacketCustomPayload>
+{
public static final ResourceLocation field_210344_a = new ResourceLocation("minecraft:brand");
private ResourceLocation channel;
private PacketBuffer data;
private ResourceLocation field_149562_a;
private PacketBuffer field_149561_c;

View File

@ -3,9 +3,9 @@
@@ -30,7 +30,7 @@
}
public void writePacketData(PacketBuffer buf) throws IOException {
- buf.writeString(GSON.toJson(this.response));
+ buf.writeString(this.response.getJson()); //Forge: Let the response cache the JSON
public void func_148840_b(PacketBuffer p_148840_1_) throws IOException {
- p_148840_1_.func_180714_a(field_149297_a.toJson(this.field_149296_b));
+ p_148840_1_.func_180714_a(this.field_149296_b.getJson()); //Forge: Let the response cache the JSON
}
public void processPacket(INetHandlerStatusClient handler) {
public void func_148833_a(INetHandlerStatusClient p_148833_1_) {

View File

@ -6,6 +6,6 @@
-public class Potion {
+public class Potion extends net.minecraftforge.registries.ForgeRegistryEntry<Potion> {
public static final RegistryNamespaced<ResourceLocation, Potion> REGISTRY = new RegistryNamespaced<ResourceLocation, Potion>();
private final Map<IAttribute, AttributeModifier> attributeModifierMap = Maps.<IAttribute, AttributeModifier>newHashMap();
private final boolean isBadEffect;
public static final RegistryNamespaced<ResourceLocation, Potion> field_188414_b = new RegistryNamespaced<ResourceLocation, Potion>();
private final Map<IAttribute, AttributeModifier> field_111188_I = Maps.<IAttribute, AttributeModifier>newHashMap();
private final boolean field_76418_K;

View File

@ -6,6 +6,6 @@
-public class PotionType {
+public class PotionType extends net.minecraftforge.registries.ForgeRegistryEntry<PotionType> {
private static final ResourceLocation EMPTY = new ResourceLocation("empty");
public static final RegistryNamespacedDefaultedByKey<ResourceLocation, PotionType> REGISTRY = new RegistryNamespacedDefaultedByKey<ResourceLocation, PotionType>(EMPTY);
private final String baseName;
private static final ResourceLocation field_185177_b = new ResourceLocation("empty");
public static final RegistryNamespacedDefaultedByKey<ResourceLocation, PotionType> field_185176_a = new RegistryNamespacedDefaultedByKey<ResourceLocation, PotionType>(field_185177_b);
private final String field_185179_d;

View File

@ -1,145 +1,145 @@
--- a/net/minecraft/server/MinecraftServer.java
+++ b/net/minecraft/server/MinecraftServer.java
@@ -148,7 +148,6 @@
private int buildLimit;
private int maxPlayerIdleMinutes;
public final long[] tickTimeArray = new long[100];
- public long[][] timeOfLastDimensionTick;
private KeyPair serverKeyPair;
private String serverOwner;
private String folderName;
private int field_71280_D;
private int field_143008_E;
public final long[] field_71311_j = new long[100];
- public long[][] field_71312_k;
private KeyPair field_71292_I;
private String field_71293_J;
private String field_71294_K;
@@ -287,8 +286,7 @@
public void loadAllWorlds(String saveName, String worldNameIn, long seed, WorldType type, JsonElement generatorOptions) {
this.convertMapIfNeeded(saveName);
public void func_71247_a(String p_71247_1_, String p_71247_2_, long p_71247_3_, WorldType p_71247_5_, JsonElement p_71247_6_) {
this.func_71237_c(p_71247_1_);
this.func_200245_b(new TextComponentTranslation("menu.loadingLevel", new Object[0]));
- this.worlds = new WorldServer[3];
- this.timeOfLastDimensionTick = new long[this.worlds.length][100];
+ this.worlds = new WorldServer[1]; //Forge only initialize overworld, we will do the rest.
ISaveHandler isavehandler = this.anvilConverterForAnvilFile.func_197715_a(saveName, this);
this.setResourcePackFromWorld(this.getFolderName(), isavehandler);
WorldInfo worldinfo = isavehandler.loadWorldInfo();
- this.field_71305_c = new WorldServer[3];
- this.field_71312_k = new long[this.field_71305_c.length][100];
+ this.field_71305_c = new WorldServer[1]; //Forge only initialize overworld, we will do the rest.
ISaveHandler isavehandler = this.field_71310_m.func_197715_a(p_71247_1_, this);
this.func_175584_a(this.func_71270_I(), isavehandler);
WorldInfo worldinfo = isavehandler.func_75757_d();
@@ -340,6 +338,18 @@
}
}
+ for (int dim : net.minecraftforge.common.DimensionManager.getStaticDimensionIDs()) {
+ WorldServer world = this.worlds[0];
+ WorldServer world = this.field_71305_c[0];
+ if (dim != 0) {
+ world = (WorldServer)(new WorldServerMulti(this, isavehandler, dim, this.worlds[0], this.profiler).init());
+ world.addEventListener(new ServerWorldEventHandler(this, world));
+ if (!this.isSinglePlayer()) {
+ world.getWorldInfo().setGameType(getGameType());
+ world = (WorldServer)(new WorldServerMulti(this, isavehandler, dim, this.field_71305_c[0], this.field_71304_b).func_175643_b());
+ world.func_72954_a(new ServerWorldEventHandler(this, world));
+ if (!this.func_71264_H()) {
+ world.func_72912_H().func_76060_a(func_71265_f());
+ }
+ }
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Load(world));
+ }
+
this.playerList.setPlayerManager(this.worlds);
this.field_71318_t.func_72364_a(this.field_71305_c);
if (worldinfo.func_201357_P() != null) {
this.func_201300_aS().func_201381_a(worldinfo.func_201357_P());
@@ -378,7 +388,7 @@
this.func_200245_b(new TextComponentTranslation("menu.generatingTerrain", new Object[0]));
int j1 = 0;
LOGGER.info("Preparing start region for level 0");
- WorldServer worldserver = this.worlds[0];
+ WorldServer worldserver = getWorld(0);
BlockPos blockpos = worldserver.getSpawnPoint();
field_147145_h.info("Preparing start region for level 0");
- WorldServer worldserver = this.field_71305_c[0];
+ WorldServer worldserver = func_71218_a(0);
BlockPos blockpos = worldserver.func_175694_M();
List<ChunkPos> list = Lists.<ChunkPos>newArrayList();
Set<ChunkPos> set = Sets.<ChunkPos>newConcurrentHashSet();
@@ -493,9 +503,14 @@
for(WorldServer worldserver1 : this.worlds) {
for(WorldServer worldserver1 : this.field_71305_c) {
if (worldserver1 != null) {
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Unload(worldserver1));
worldserver1.close();
}
}
+
+ WorldServer[] tmp = this.worlds;
+ WorldServer[] tmp = this.field_71305_c;
+ for (WorldServer world : tmp)
+ net.minecraftforge.common.DimensionManager.setWorld(world.provider.getId(), null, this);
+ net.minecraftforge.common.DimensionManager.setWorld(world.field_73011_w.getId(), null, this);
}
if (this.usageSnooper.isSnooperRunning()) {
if (this.field_71307_n.func_76468_d()) {
@@ -523,6 +538,7 @@
public void run() {
try {
if (this.init()) {
if (this.func_71197_b()) {
+ net.minecraftforge.fml.server.ServerLifecycleHooks.handleServerStarted(this);
this.field_211151_aa = Util.func_211177_b();
this.statusResponse.setServerDescription(new TextComponentString(this.motd));
this.statusResponse.setVersion(new ServerStatusResponse.Version("1.13", 393));
this.field_147147_p.func_151315_a(new TextComponentString(this.field_71286_C));
this.field_147147_p.func_151321_a(new ServerStatusResponse.Version("1.13", 393));
@@ -546,7 +562,10 @@
this.serverIsRunning = true;
this.field_71296_Q = true;
}
+ net.minecraftforge.fml.server.ServerLifecycleHooks.handleServerStopping(this);
+ net.minecraftforge.fml.server.ServerLifecycleHooks.expectServerStopped(); // has to come before finalTick to avoid race conditions
} else {
+ net.minecraftforge.fml.server.ServerLifecycleHooks.expectServerStopped(); // has to come before finalTick to avoid race conditions
this.finalTick((CrashReport)null);
this.func_71228_a((CrashReport)null);
}
} catch (Throwable throwable1) {
@@ -565,6 +584,7 @@
LOGGER.error("We were unable to save this crash report to disk.");
field_147145_h.error("We were unable to save this crash report to disk.");
}
+ net.minecraftforge.fml.server.ServerLifecycleHooks.expectServerStopped(); // has to come before finalTick to avoid race conditions
this.finalTick(crashreport);
this.func_71228_a(crashreport);
} finally {
try {
@@ -573,6 +593,7 @@
} catch (Throwable throwable) {
LOGGER.error("Exception stopping the server", throwable);
field_147145_h.error("Exception stopping the server", throwable);
} finally {
+ net.minecraftforge.fml.server.ServerLifecycleHooks.handleServerStopped(this);
this.systemExitNow();
this.func_71240_o();
}
@@ -648,6 +669,7 @@
Collections.shuffle(Arrays.asList(agameprofile));
this.statusResponse.getPlayers().setPlayers(agameprofile);
+ this.statusResponse.invalidateJson();
this.field_147147_p.func_151318_b().func_151330_a(agameprofile);
+ this.field_147147_p.invalidateJson();
}
if (this.tickCounter % 900 == 0) {
if (this.field_71315_w % 900 == 0) {
@@ -686,16 +708,18 @@
this.getFunctionManager().update();
this.profiler.endStartSection("levels");
this.func_193030_aL().func_73660_a();
this.field_71304_b.func_76318_c("levels");
- for(int i = 0; i < this.worlds.length; ++i) {
+ Integer[] ids = net.minecraftforge.common.DimensionManager.getIDs(this.tickCounter % 200 == 0);
- for(int i = 0; i < this.field_71305_c.length; ++i) {
+ Integer[] ids = net.minecraftforge.common.DimensionManager.getIDs(this.field_71315_w % 200 == 0);
+ for(int x = 0; x < ids.length; ++x) {
+ int id = ids[x];
long j = Util.func_211178_c();
- if (i == 0 || this.getAllowNether()) {
- WorldServer worldserver = this.worlds[i];
+ WorldServer worldserver = getWorld(id);
+ if (id == 0 || this.getAllowNether()) {
this.profiler.func_194340_a(() -> {
return worldserver.getWorldInfo().getWorldName();
- if (i == 0 || this.func_71255_r()) {
- WorldServer worldserver = this.field_71305_c[i];
+ WorldServer worldserver = func_71218_a(id);
+ if (id == 0 || this.func_71255_r()) {
this.field_71304_b.func_194340_a(() -> {
return worldserver.func_72912_H().func_76065_j();
});
if (this.tickCounter % 20 == 0) {
this.profiler.startSection("timeSync");
- this.playerList.sendPacketToAllPlayersInDimension(new SPacketTimeUpdate(worldserver.getTotalWorldTime(), worldserver.getWorldTime(), worldserver.getGameRules().getBoolean("doDaylightCycle")), worldserver.provider.getDimensionType().getId());
+ this.playerList.sendPacketToAllPlayersInDimension(new SPacketTimeUpdate(worldserver.getTotalWorldTime(), worldserver.getWorldTime(), worldserver.getGameRules().getBoolean("doDaylightCycle")), worldserver.provider.getId());
this.profiler.endSection();
if (this.field_71315_w % 20 == 0) {
this.field_71304_b.func_76320_a("timeSync");
- this.field_71318_t.func_148537_a(new SPacketTimeUpdate(worldserver.func_82737_E(), worldserver.func_72820_D(), worldserver.func_82736_K().func_82766_b("doDaylightCycle")), worldserver.field_73011_w.func_186058_p().func_186068_a());
+ this.field_71318_t.func_148537_a(new SPacketTimeUpdate(worldserver.func_82737_E(), worldserver.func_72820_D(), worldserver.func_82736_K().func_82766_b("doDaylightCycle")), worldserver.field_73011_w.getId());
this.field_71304_b.func_76319_b();
}
@@ -724,9 +748,11 @@
this.profiler.endSection();
this.field_71304_b.func_76319_b();
}
- this.timeOfLastDimensionTick[i][this.tickCounter % 100] = Util.func_211178_c() - j;
+ worldserver.setTickTime(this.tickCounter, Util.func_211178_c() - j);
- this.field_71312_k[i][this.field_71315_w % 100] = Util.func_211178_c() - j;
+ worldserver.setTickTime(this.field_71315_w, Util.func_211178_c() - j);
}
+ this.profiler.endStartSection("dim_unloading");
+ this.field_71304_b.func_76318_c("dim_unloading");
+ net.minecraftforge.common.DimensionManager.unloadWorlds();
this.profiler.endStartSection("connection");
this.getNetworkSystem().networkTick();
this.profiler.endStartSection("players");
this.field_71304_b.func_76318_c("connection");
this.func_147137_ag().func_151269_c();
this.field_71304_b.func_76318_c("players");
@@ -749,6 +775,14 @@
}
@ -147,33 +147,33 @@
+ //Forge: Copied from DedicatedServer.init as to run as early as possible, Old code left in place intentionally.
+ //Done in good faith with permission: https://github.com/MinecraftForge/MinecraftForge/issues/3659#issuecomment-390467028
+ ServerEula eula = new ServerEula(new File("eula.txt"));
+ if (!eula.hasAcceptedEULA()) {
+ LOGGER.info("You need to agree to the EULA in order to run the server. Go to eula.txt for more info.");
+ eula.createEULAFile();
+ if (!eula.func_154346_a()) {
+ field_147145_h.info("You need to agree to the EULA in order to run the server. Go to eula.txt for more info.");
+ eula.func_154348_b();
+ return;
+ }
Bootstrap.register();
Bootstrap.func_151354_b();
try {
@@ -851,7 +885,7 @@
}
public void startServerThread() {
- this.serverThread = new Thread(this, "Server thread");
+ this.serverThread = new Thread(net.minecraftforge.fml.common.thread.SidedThreadGroups.SERVER, this, "Server thread");
this.serverThread.setUncaughtExceptionHandler((p_195574_0_, p_195574_1_) -> {
LOGGER.error(p_195574_1_);
public void func_71256_s() {
- this.field_175590_aa = new Thread(this, "Server thread");
+ this.field_175590_aa = new Thread(net.minecraftforge.fml.common.thread.SidedThreadGroups.SERVER, this, "Server thread");
this.field_175590_aa.setUncaughtExceptionHandler((p_195574_0_, p_195574_1_) -> {
field_147145_h.error(p_195574_1_);
});
@@ -871,11 +905,7 @@
}
public WorldServer getWorld(int dimension) {
- if (dimension == -1) {
- return this.worlds[1];
public WorldServer func_71218_a(int p_71218_1_) {
- if (p_71218_1_ == -1) {
- return this.field_71305_c[1];
- } else {
- return dimension == 1 ? this.worlds[2] : this.worlds[0];
- return p_71218_1_ == 1 ? this.field_71305_c[2] : this.field_71305_c[0];
- }
+ return net.minecraftforge.common.DimensionManager.getWorld(dimension, true, true);
+ return net.minecraftforge.common.DimensionManager.getWorld(p_71218_1_, true, true);
}
public WorldServer func_200667_a(DimensionType p_200667_1_) {
@ -185,4 +185,4 @@
+ return net.minecraftforge.common.ForgeHooks.getServerModName();
}
public CrashReport addServerInfoToCrashReport(CrashReport report) {
public CrashReport func_71230_b(CrashReport p_71230_1_) {

View File

@ -1,33 +1,33 @@
--- a/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/net/minecraft/server/dedicated/DedicatedServer.java
@@ -110,6 +110,7 @@
LOGGER.warn("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\"");
field_155771_h.warn("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\"");
}
+ net.minecraftforge.fml.server.ServerModLoader.begin(this);
LOGGER.info("Loading properties");
this.settings = new PropertyManager(new File("server.properties"));
this.eula = new ServerEula(new File("eula.txt"));
field_155771_h.info("Loading properties");
this.field_71340_o = new PropertyManager(new File("server.properties"));
this.field_154332_n = new ServerEula(new File("eula.txt"));
@@ -181,6 +182,7 @@
if (!PreYggdrasilConverter.tryConvert(this.settings)) {
if (!PreYggdrasilConverter.func_152714_a(this.field_71340_o)) {
return false;
} else {
+ net.minecraftforge.fml.server.ServerModLoader.end();
this.setPlayerList(new DedicatedPlayerList(this));
this.func_184105_a(new DedicatedPlayerList(this));
long j = Util.func_211178_c();
if (this.getFolderName() == null) {
if (this.func_71270_I() == null) {
@@ -218,6 +220,7 @@
TileEntitySkull.setProfileCache(this.getPlayerProfileCache());
TileEntitySkull.setSessionService(this.getMinecraftSessionService());
PlayerProfileCache.setOnlineMode(this.isServerInOnlineMode());
TileEntitySkull.func_184293_a(this.func_152358_ax());
TileEntitySkull.func_184294_a(this.func_147130_as());
PlayerProfileCache.func_187320_a(this.func_71266_T());
+ if (!net.minecraftforge.fml.server.ServerLifecycleHooks.handleServerAboutToStart(this)) return false;
LOGGER.info("Preparing level \"{}\"", (Object)this.getFolderName());
field_155771_h.info("Preparing level \"{}\"", (Object)this.func_71270_I());
JsonObject jsonobject = new JsonObject();
if (worldtype == WorldType.FLAT) {
if (worldtype == WorldType.field_77138_c) {
@@ -257,7 +260,8 @@
}
Items.AIR.getSubItems(ItemGroup.SEARCH, NonNullList.create());
Items.field_190931_a.func_150895_a(ItemGroup.field_78027_g, NonNullList.func_191196_a());
- return true;
+ // <3 you Grum for this, saves us ~30 patch files! --^
+ return net.minecraftforge.fml.server.ServerLifecycleHooks.handleServerStarting(this);

View File

@ -2,58 +2,58 @@
+++ b/net/minecraft/server/integrated/IntegratedServer.java
@@ -62,8 +62,7 @@
public void loadAllWorlds(String saveName, String worldNameIn, long seed, WorldType type, JsonElement generatorOptions) {
this.convertMapIfNeeded(saveName);
- this.worlds = new WorldServer[3];
- this.timeOfLastDimensionTick = new long[this.worlds.length][100];
+ this.worlds = new WorldServer[1]; //Forge only initialize overworld, we will do the rest.
ISaveHandler isavehandler = this.getActiveAnvilConverter().func_197715_a(saveName, this);
this.setResourcePackFromWorld(this.getFolderName(), isavehandler);
WorldInfo worldinfo = isavehandler.loadWorldInfo();
public void func_71247_a(String p_71247_1_, String p_71247_2_, long p_71247_3_, WorldType p_71247_5_, JsonElement p_71247_6_) {
this.func_71237_c(p_71247_1_);
- this.field_71305_c = new WorldServer[3];
- this.field_71312_k = new long[this.field_71305_c.length][100];
+ this.field_71305_c = new WorldServer[1]; //Forge only initialize overworld, we will do the rest.
ISaveHandler isavehandler = this.func_71254_M().func_197715_a(p_71247_1_, this);
this.func_175584_a(this.func_71270_I(), isavehandler);
WorldInfo worldinfo = isavehandler.func_75757_d();
@@ -100,6 +99,18 @@
this.worlds[i].addEventListener(new ServerWorldEventHandler(this, this.worlds[i]));
this.field_71305_c[i].func_72954_a(new ServerWorldEventHandler(this, this.field_71305_c[i]));
}
+ for (int dim : net.minecraftforge.common.DimensionManager.getStaticDimensionIDs()) {
+ WorldServer world = this.worlds[0];
+ WorldServer world = this.field_71305_c[0];
+ if (dim != 0) {
+ world = (WorldServer)(new WorldServerMulti(this, isavehandler, dim, this.worlds[0], this.profiler).init());
+ world.addEventListener(new ServerWorldEventHandler(this, world));
+ if (!this.isSinglePlayer()) {
+ world.getWorldInfo().setGameType(getGameType());
+ world = (WorldServer)(new WorldServerMulti(this, isavehandler, dim, this.field_71305_c[0], this.field_71304_b).func_175643_b());
+ world.func_72954_a(new ServerWorldEventHandler(this, world));
+ if (!this.func_71264_H()) {
+ world.func_72912_H().func_76060_a(func_71265_f());
+ }
+ }
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Load(world));
+ }
+
this.getPlayerList().setPlayerManager(this.worlds);
this.func_184103_al().func_72364_a(this.field_71305_c);
if (worldinfo.func_201357_P() != null) {
this.func_201300_aS().func_201381_a(worldinfo.func_201357_P());
@@ -121,9 +132,10 @@
this.setAllowFlight(true);
LOGGER.info("Generating keypair");
this.setKeyPair(CryptManager.generateKeyPair());
this.func_71245_h(true);
field_147148_h.info("Generating keypair");
this.func_71253_a(CryptManager.func_75891_b());
+ if (!net.minecraftforge.fml.server.ServerLifecycleHooks.handleServerAboutToStart(this)) return false;
this.loadAllWorlds(this.getFolderName(), this.getWorldName(), this.worldSettings.getSeed(), this.worldSettings.getTerrainType(), this.worldSettings.func_205391_j());
this.setMOTD(this.getServerOwner() + " - " + this.worlds[0].getWorldInfo().getWorldName());
this.func_71247_a(this.func_71270_I(), this.func_71221_J(), this.field_71350_m.func_77160_d(), this.field_71350_m.func_77165_h(), this.field_71350_m.func_205391_j());
this.func_71205_p(this.func_71214_G() + " - " + this.field_71305_c[0].func_72912_H().func_76065_j());
- return true;
+ return net.minecraftforge.fml.server.ServerLifecycleHooks.handleServerStarting(this);
}
public void tick() {
public void func_71217_p() {
@@ -176,6 +188,7 @@
}
public EnumDifficulty getDifficulty() {
+ if (this.mc.world == null) return this.mc.gameSettings.difficulty; // Fix NPE just in case.
return this.mc.world.getWorldInfo().getDifficulty();
public EnumDifficulty func_147135_j() {
+ if (this.field_71349_l.field_71441_e == null) return this.field_71349_l.field_71474_y.field_74318_M; // Fix NPE just in case.
return this.field_71349_l.field_71441_e.func_72912_H().func_176130_y();
}
@@ -275,6 +288,7 @@
}
public void initiateShutdown() {
+ if (isServerRunning())
Futures.getUnchecked(this.addScheduledTask(() -> {
for(EntityPlayerMP entityplayermp : Lists.newArrayList(this.getPlayerList().getPlayers())) {
if (!entityplayermp.getUniqueID().equals(this.field_211528_n)) {
public void func_71263_m() {
+ if (func_71278_l())
Futures.getUnchecked(this.func_152344_a(() -> {
for(EntityPlayerMP entityplayermp : Lists.newArrayList(this.func_184103_al().func_181057_v())) {
if (!entityplayermp.func_110124_au().equals(this.field_211528_n)) {

View File

@ -3,8 +3,8 @@
@@ -19,6 +19,7 @@
}
public void processHandshake(CPacketHandshake packetIn) {
+ if (!net.minecraftforge.fml.server.ServerLifecycleHooks.handleServerLogin(packetIn, this.networkManager)) return;
switch(packetIn.getRequestedState()) {
public void func_147383_a(CPacketHandshake p_147383_1_) {
+ if (!net.minecraftforge.fml.server.ServerLifecycleHooks.handleServerLogin(p_147383_1_, this.field_147386_b)) return;
switch(p_147383_1_.func_149594_c()) {
case LOGIN:
this.networkManager.setConnectionState(EnumConnectionState.LOGIN);
this.field_147386_b.func_150723_a(EnumConnectionState.LOGIN);

View File

@ -3,53 +3,53 @@
@@ -55,6 +55,12 @@
}
public void update() {
+ if (this.currentLoginState == LoginState.NEGOTIATING) {
public void func_73660_a() {
+ if (this.field_147328_g == LoginState.NEGOTIATING) {
+ // We force the state into "NEGOTIATING" which is otherwise unused. Once we're completed we move the negotiation onto "READY_TO_ACCEPT"
+ // Might want to promote player object creation to here as well..
+ boolean negotiationComplete = net.minecraftforge.fml.network.NetworkHooks.tickNegotiation(this, this.networkManager, this.player);
+ if (negotiationComplete) this.currentLoginState = LoginState.READY_TO_ACCEPT;
+ boolean negotiationComplete = net.minecraftforge.fml.network.NetworkHooks.tickNegotiation(this, this.field_147333_a, this.field_181025_l);
+ if (negotiationComplete) this.field_147328_g = LoginState.READY_TO_ACCEPT;
+ } else
if (this.currentLoginState == NetHandlerLoginServer.LoginState.READY_TO_ACCEPT) {
this.tryAcceptPlayer();
} else if (this.currentLoginState == NetHandlerLoginServer.LoginState.DELAY_ACCEPT) {
if (this.field_147328_g == NetHandlerLoginServer.LoginState.READY_TO_ACCEPT) {
this.func_147326_c();
} else if (this.field_147328_g == NetHandlerLoginServer.LoginState.DELAY_ACCEPT) {
@@ -126,7 +132,7 @@
this.currentLoginState = NetHandlerLoginServer.LoginState.KEY;
this.networkManager.sendPacket(new SPacketEncryptionRequest("", this.server.getKeyPair().getPublic(), this.verifyToken));
this.field_147328_g = NetHandlerLoginServer.LoginState.KEY;
this.field_147333_a.func_179290_a(new SPacketEncryptionRequest("", this.field_147327_f.func_71250_E().getPublic(), this.field_147330_e));
} else {
- this.currentLoginState = NetHandlerLoginServer.LoginState.READY_TO_ACCEPT;
+ this.currentLoginState = LoginState.NEGOTIATING;
- this.field_147328_g = NetHandlerLoginServer.LoginState.READY_TO_ACCEPT;
+ this.field_147328_g = LoginState.NEGOTIATING;
}
}
@@ -149,11 +155,11 @@
NetHandlerLoginServer.this.loginGameProfile = NetHandlerLoginServer.this.server.getMinecraftSessionService().hasJoinedServer(new GameProfile((UUID)null, gameprofile.getName()), s, this.getAddress());
if (NetHandlerLoginServer.this.loginGameProfile != null) {
NetHandlerLoginServer.LOGGER.info("UUID of player {} is {}", NetHandlerLoginServer.this.loginGameProfile.getName(), NetHandlerLoginServer.this.loginGameProfile.getId());
- NetHandlerLoginServer.this.currentLoginState = NetHandlerLoginServer.LoginState.READY_TO_ACCEPT;
+ NetHandlerLoginServer.this.currentLoginState = LoginState.NEGOTIATING;
} else if (NetHandlerLoginServer.this.server.isSinglePlayer()) {
NetHandlerLoginServer.LOGGER.warn("Failed to verify username but will let them in anyway!");
NetHandlerLoginServer.this.loginGameProfile = NetHandlerLoginServer.this.getOfflineProfile(gameprofile);
- NetHandlerLoginServer.this.currentLoginState = NetHandlerLoginServer.LoginState.READY_TO_ACCEPT;
+ NetHandlerLoginServer.this.currentLoginState = LoginState.NEGOTIATING;
NetHandlerLoginServer.this.field_147337_i = NetHandlerLoginServer.this.field_147327_f.func_147130_as().hasJoinedServer(new GameProfile((UUID)null, gameprofile.getName()), s, this.func_191235_a());
if (NetHandlerLoginServer.this.field_147337_i != null) {
NetHandlerLoginServer.field_147332_c.info("UUID of player {} is {}", NetHandlerLoginServer.this.field_147337_i.getName(), NetHandlerLoginServer.this.field_147337_i.getId());
- NetHandlerLoginServer.this.field_147328_g = NetHandlerLoginServer.LoginState.READY_TO_ACCEPT;
+ NetHandlerLoginServer.this.field_147328_g = LoginState.NEGOTIATING;
} else if (NetHandlerLoginServer.this.field_147327_f.func_71264_H()) {
NetHandlerLoginServer.field_147332_c.warn("Failed to verify username but will let them in anyway!");
NetHandlerLoginServer.this.field_147337_i = NetHandlerLoginServer.this.func_152506_a(gameprofile);
- NetHandlerLoginServer.this.field_147328_g = NetHandlerLoginServer.LoginState.READY_TO_ACCEPT;
+ NetHandlerLoginServer.this.field_147328_g = LoginState.NEGOTIATING;
} else {
NetHandlerLoginServer.this.disconnect(new TextComponentTranslation("multiplayer.disconnect.unverified_username", new Object[0]));
NetHandlerLoginServer.LOGGER.error("Username '{}' tried to join with an invalid session", (Object)gameprofile.getName());
NetHandlerLoginServer.this.func_194026_b(new TextComponentTranslation("multiplayer.disconnect.unverified_username", new Object[0]));
NetHandlerLoginServer.field_147332_c.error("Username '{}' tried to join with an invalid session", (Object)gameprofile.getName());
@@ -162,7 +168,7 @@
if (NetHandlerLoginServer.this.server.isSinglePlayer()) {
NetHandlerLoginServer.LOGGER.warn("Authentication servers are down but will let them in anyway!");
NetHandlerLoginServer.this.loginGameProfile = NetHandlerLoginServer.this.getOfflineProfile(gameprofile);
- NetHandlerLoginServer.this.currentLoginState = NetHandlerLoginServer.LoginState.READY_TO_ACCEPT;
+ NetHandlerLoginServer.this.currentLoginState = LoginState.NEGOTIATING;
if (NetHandlerLoginServer.this.field_147327_f.func_71264_H()) {
NetHandlerLoginServer.field_147332_c.warn("Authentication servers are down but will let them in anyway!");
NetHandlerLoginServer.this.field_147337_i = NetHandlerLoginServer.this.func_152506_a(gameprofile);
- NetHandlerLoginServer.this.field_147328_g = NetHandlerLoginServer.LoginState.READY_TO_ACCEPT;
+ NetHandlerLoginServer.this.field_147328_g = LoginState.NEGOTIATING;
} else {
NetHandlerLoginServer.this.disconnect(new TextComponentTranslation("multiplayer.disconnect.authservers_down", new Object[0]));
NetHandlerLoginServer.LOGGER.error("Couldn't verify username because servers are unavailable");
NetHandlerLoginServer.this.func_194026_b(new TextComponentTranslation("multiplayer.disconnect.authservers_down", new Object[0]));
NetHandlerLoginServer.field_147332_c.error("Couldn't verify username because servers are unavailable");
@@ -183,6 +189,7 @@
}
public void func_209526_a(CPacketCustomPayloadLogin p_209526_1_) {
+ if (!net.minecraftforge.fml.network.NetworkHooks.onCustomPayload(p_209526_1_, this.networkManager))
this.disconnect(new TextComponentTranslation("multiplayer.disconnect.unexpected_query_response", new Object[0]));
+ if (!net.minecraftforge.fml.network.NetworkHooks.onCustomPayload(p_209526_1_, this.field_147333_a))
this.func_194026_b(new TextComponentTranslation("multiplayer.disconnect.unexpected_query_response", new Object[0]));
}

View File

@ -10,9 +10,9 @@
-public abstract class TileEntity {
+public abstract class TileEntity extends net.minecraftforge.common.capabilities.CapabilityProvider implements net.minecraftforge.common.extensions.IForgeTileEntity {
private static final Logger LOGGER = LogManager.getLogger();
private static final Logger field_145852_a = LogManager.getLogger();
private final TileEntityType<?> field_200663_e;
protected World world;
protected World field_145850_b;
@@ -26,6 +27,7 @@
public TileEntity(TileEntityType<?> p_i48289_1_) {

View File

@ -2,60 +2,60 @@
+++ b/net/minecraft/tileentity/TileEntityBrewingStand.java
@@ -133,6 +133,7 @@
private boolean canBrew() {
ItemStack itemstack = this.brewingItemStacks.get(3);
+ if (!itemstack.isEmpty()) return net.minecraftforge.common.brewing.BrewingRecipeRegistry.canBrew(brewingItemStacks, itemstack, OUTPUT_SLOTS); // divert to VanillaBrewingRegistry
if (itemstack.isEmpty()) {
private boolean func_145934_k() {
ItemStack itemstack = this.field_145945_j.get(3);
+ if (!itemstack.func_190926_b()) return net.minecraftforge.common.brewing.BrewingRecipeRegistry.canBrew(field_145945_j, itemstack, field_145947_i); // divert to VanillaBrewingRegistry
if (itemstack.func_190926_b()) {
return false;
} else if (!PotionBrewing.isReagent(itemstack)) {
} else if (!PotionBrewing.func_185205_a(itemstack)) {
@@ -150,16 +151,15 @@
}
private void brewPotions() {
+ if (net.minecraftforge.event.ForgeEventFactory.onPotionAttemptBrew(brewingItemStacks)) return;
ItemStack itemstack = this.brewingItemStacks.get(3);
private void func_145940_l() {
+ if (net.minecraftforge.event.ForgeEventFactory.onPotionAttemptBrew(field_145945_j)) return;
ItemStack itemstack = this.field_145945_j.get(3);
- for(int i = 0; i < 3; ++i) {
- this.brewingItemStacks.set(i, PotionBrewing.doReaction(itemstack, this.brewingItemStacks.get(i)));
- this.field_145945_j.set(i, PotionBrewing.func_185212_d(itemstack, this.field_145945_j.get(i)));
- }
+ net.minecraftforge.common.brewing.BrewingRecipeRegistry.brewPotions(brewingItemStacks, itemstack, OUTPUT_SLOTS);
+ net.minecraftforge.common.brewing.BrewingRecipeRegistry.brewPotions(field_145945_j, itemstack, field_145947_i);
itemstack.shrink(1);
BlockPos blockpos = this.getPos();
- if (itemstack.getItem().hasContainerItem()) {
- ItemStack itemstack1 = new ItemStack(itemstack.getItem().getContainerItem());
itemstack.func_190918_g(1);
BlockPos blockpos = this.func_174877_v();
- if (itemstack.func_77973_b().func_77634_r()) {
- ItemStack itemstack1 = new ItemStack(itemstack.func_77973_b().func_77668_q());
+ if (itemstack.hasContainerItem()) {
+ ItemStack itemstack1 = itemstack.getContainerItem();
if (itemstack.isEmpty()) {
if (itemstack.func_190926_b()) {
itemstack = itemstack1;
} else {
@@ -169,6 +169,7 @@
this.brewingItemStacks.set(3, itemstack);
this.world.playEvent(1035, blockpos, 0);
+ net.minecraftforge.event.ForgeEventFactory.onPotionBrewed(brewingItemStacks);
this.field_145945_j.set(3, itemstack);
this.field_145850_b.func_175718_b(1035, blockpos, 0);
+ net.minecraftforge.event.ForgeEventFactory.onPotionBrewed(field_145945_j);
}
public void readFromNBT(NBTTagCompound compound) {
public void func_145839_a(NBTTagCompound p_145839_1_) {
@@ -234,13 +235,13 @@
public boolean isItemValidForSlot(int index, ItemStack stack) {
if (index == 3) {
- return PotionBrewing.isReagent(stack);
+ return net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidIngredient(stack);
public boolean func_94041_b(int p_94041_1_, ItemStack p_94041_2_) {
if (p_94041_1_ == 3) {
- return PotionBrewing.func_185205_a(p_94041_2_);
+ return net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidIngredient(p_94041_2_);
} else {
Item item = stack.getItem();
if (index == 4) {
return item == Items.BLAZE_POWDER;
Item item = p_94041_2_.func_77973_b();
if (p_94041_1_ == 4) {
return item == Items.field_151065_br;
} else {
- return (item == Items.POTIONITEM || item == Items.SPLASH_POTION || item == Items.LINGERING_POTION || item == Items.GLASS_BOTTLE) && this.getStackInSlot(index).isEmpty();
+ return net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidInput(stack) && this.getStackInSlot(index).isEmpty();
- return (item == Items.field_151068_bn || item == Items.field_185155_bH || item == Items.field_185156_bI || item == Items.field_151069_bo) && this.func_70301_a(p_94041_1_).func_190926_b();
+ return net.minecraftforge.common.brewing.BrewingRecipeRegistry.isValidInput(p_94041_2_) && this.func_70301_a(p_94041_1_).func_190926_b();
}
}
}
@@ -302,4 +303,27 @@
public void clear() {
this.brewingItemStacks.clear();
public void func_174888_l() {
this.field_145945_j.clear();
}
+
+ net.minecraftforge.common.capabilities.OptionalCapabilityInstance<? extends net.minecraftforge.items.IItemHandler>[] handlers =
@ -75,8 +75,8 @@
+ }
+
+ @Override
+ public void invalidate() {
+ super.invalidate();
+ public void func_145843_s() {
+ super.func_145843_s();
+ for (int x = 0; x < handlers.length; x++)
+ handlers[x].invalidate();
+ }

View File

@ -1,80 +1,80 @@
--- a/net/minecraft/tileentity/TileEntityFurnace.java
+++ b/net/minecraft/tileentity/TileEntityFurnace.java
@@ -185,9 +185,9 @@
super.readFromNBT(compound);
this.furnaceItemStacks = NonNullList.<ItemStack>withSize(this.getSizeInventory(), ItemStack.EMPTY);
ItemStackHelper.loadAllItems(compound, this.furnaceItemStacks);
- this.furnaceBurnTime = compound.getShort("BurnTime");
- this.cookTime = compound.getShort("CookTime");
- this.totalCookTime = compound.getShort("CookTimeTotal");
+ this.furnaceBurnTime = compound.getInteger("BurnTime");
+ this.cookTime = compound.getInteger("CookTime");
+ this.totalCookTime = compound.getInteger("CookTimeTotal");
this.currentItemBurnTime = getItemBurnTime(this.furnaceItemStacks.get(1));
int i = compound.getShort("RecipesUsedSize");
super.func_145839_a(p_145839_1_);
this.field_145957_n = NonNullList.<ItemStack>func_191197_a(this.func_70302_i_(), ItemStack.field_190927_a);
ItemStackHelper.func_191283_b(p_145839_1_, this.field_145957_n);
- this.field_145956_a = p_145839_1_.func_74765_d("BurnTime");
- this.field_174906_k = p_145839_1_.func_74765_d("CookTime");
- this.field_174905_l = p_145839_1_.func_74765_d("CookTimeTotal");
+ this.field_145956_a = p_145839_1_.func_74762_e("BurnTime");
+ this.field_174906_k = p_145839_1_.func_74762_e("CookTime");
+ this.field_174905_l = p_145839_1_.func_74762_e("CookTimeTotal");
this.field_145963_i = func_145952_a(this.field_145957_n.get(1));
int i = p_145839_1_.func_74765_d("RecipesUsedSize");
@@ -205,9 +205,9 @@
public NBTTagCompound writeToNBT(NBTTagCompound compound) {
super.writeToNBT(compound);
- compound.setShort("BurnTime", (short)this.furnaceBurnTime);
- compound.setShort("CookTime", (short)this.cookTime);
- compound.setShort("CookTimeTotal", (short)this.totalCookTime);
+ compound.setInteger("BurnTime", this.furnaceBurnTime);
+ compound.setInteger("CookTime", this.cookTime);
+ compound.setInteger("CookTimeTotal", this.totalCookTime);
ItemStackHelper.saveAllItems(compound, this.furnaceItemStacks);
compound.setShort("RecipesUsedSize", (short)this.field_203901_m.size());
public NBTTagCompound func_189515_b(NBTTagCompound p_189515_1_) {
super.func_189515_b(p_189515_1_);
- p_189515_1_.func_74777_a("BurnTime", (short)this.field_145956_a);
- p_189515_1_.func_74777_a("CookTime", (short)this.field_174906_k);
- p_189515_1_.func_74777_a("CookTimeTotal", (short)this.field_174905_l);
+ p_189515_1_.func_74768_a("BurnTime", this.field_145956_a);
+ p_189515_1_.func_74768_a("CookTime", this.field_174906_k);
+ p_189515_1_.func_74768_a("CookTimeTotal", this.field_174905_l);
ItemStackHelper.func_191282_a(p_189515_1_, this.field_145957_n);
p_189515_1_.func_74777_a("RecipesUsedSize", (short)this.field_203901_m.size());
int i = 0;
@@ -254,6 +254,10 @@
this.currentItemBurnTime = this.furnaceBurnTime;
if (this.isBurning()) {
this.field_145963_i = this.field_145956_a;
if (this.func_145950_i()) {
flag1 = true;
+ if (itemstack.hasContainerItem()) {
+ this.furnaceItemStacks.set(1, itemstack.getContainerItem());
+ this.field_145957_n.set(1, itemstack.getContainerItem());
+ }
+ else
if (!itemstack.isEmpty()) {
Item item = itemstack.getItem();
itemstack.shrink(1);
if (!itemstack.func_190926_b()) {
Item item = itemstack.func_77973_b();
itemstack.func_190918_g(1);
@@ -308,10 +312,10 @@
return true;
} else if (!itemstack1.isItemEqual(itemstack)) {
} else if (!itemstack1.func_77969_a(itemstack)) {
return false;
- } else if (itemstack1.getCount() < this.getInventoryStackLimit() && itemstack1.getCount() < itemstack1.getMaxStackSize()) {
+ } else if (itemstack1.getCount() + itemstack.getCount() <= this.getInventoryStackLimit() && itemstack1.getCount() < itemstack1.getMaxStackSize()) { // Forge fix: make furnace respect stack sizes in furnace recipes
- } else if (itemstack1.func_190916_E() < this.func_70297_j_() && itemstack1.func_190916_E() < itemstack1.func_77976_d()) {
+ } else if (itemstack1.func_190916_E() + itemstack.func_190916_E() <= this.func_70297_j_() && itemstack1.func_190916_E() < itemstack1.func_77976_d()) { // Forge fix: make furnace respect stack sizes in furnace recipes
return true;
} else {
- return itemstack1.getCount() < itemstack.getMaxStackSize();
+ return itemstack1.getCount() + itemstack.getCount() <= itemstack.getMaxStackSize(); // Forge fix: make furnace respect stack sizes in furnace recipes
- return itemstack1.func_190916_E() < itemstack.func_77976_d();
+ return itemstack1.func_190916_E() + itemstack.func_190916_E() <= itemstack.func_77976_d(); // Forge fix: make furnace respect stack sizes in furnace recipes
}
}
} else {
@@ -327,7 +331,7 @@
if (itemstack2.isEmpty()) {
this.furnaceItemStacks.set(2, itemstack1.copy());
} else if (itemstack2.getItem() == itemstack1.getItem()) {
- itemstack2.grow(1);
+ itemstack2.grow(itemstack1.getCount());
if (itemstack2.func_190926_b()) {
this.field_145957_n.set(2, itemstack1.func_77946_l());
} else if (itemstack2.func_77973_b() == itemstack1.func_77973_b()) {
- itemstack2.func_190917_f(1);
+ itemstack2.func_190917_f(itemstack1.func_190916_E());
}
if (!this.world.isRemote) {
if (!this.field_145850_b.field_72995_K) {
@@ -347,12 +351,13 @@
return 0;
} else {
Item item = stack.getItem();
Item item = p_145952_0_.func_77973_b();
- return func_201564_p().getOrDefault(item, 0);
+ int ret = stack.getBurnTime();
+ return net.minecraftforge.event.ForgeEventFactory.getItemBurnTime(stack, ret == -1 ? func_201564_p().getOrDefault(item, 0) : ret);
+ int ret = p_145952_0_.getBurnTime();
+ return net.minecraftforge.event.ForgeEventFactory.getItemBurnTime(p_145952_0_, ret == -1 ? func_201564_p().getOrDefault(item, 0) : ret);
}
}
public static boolean isItemFuel(ItemStack stack) {
- return func_201564_p().containsKey(stack.getItem());
+ return getItemBurnTime(stack) > 0;
public static boolean func_145954_b(ItemStack p_145954_0_) {
- return func_201564_p().containsKey(p_145954_0_.func_77973_b());
+ return func_145952_a(p_145954_0_) > 0;
}
public boolean isUsableByPlayer(EntityPlayer player) {
public boolean func_70300_a(EntityPlayer p_70300_1_) {
@@ -501,4 +506,27 @@
this.field_203901_m.clear();
@ -97,8 +97,8 @@
+ }
+
+ @Override
+ public void invalidate() {
+ super.invalidate();
+ public void func_145843_s() {
+ super.func_145843_s();
+ for (int x = 0; x < handlers.length; x++)
+ handlers[x].invalidate();
+ }

View File

@ -6,6 +6,6 @@
-public class SoundEvent {
+public class SoundEvent extends net.minecraftforge.registries.ForgeRegistryEntry<SoundEvent> {
public static final RegistryNamespaced<ResourceLocation, SoundEvent> REGISTRY = new RegistryNamespaced<ResourceLocation, SoundEvent>();
private final ResourceLocation soundName;
public static final RegistryNamespaced<ResourceLocation, SoundEvent> field_187505_a = new RegistryNamespaced<ResourceLocation, SoundEvent>();
private final ResourceLocation field_187506_b;

View File

@ -1,7 +1,7 @@
--- a/net/minecraft/util/text/translation/LanguageMap.java
+++ b/net/minecraft/util/text/translation/LanguageMap.java
@@ -26,21 +26,34 @@
private long lastUpdateTimeInMilliseconds;
private long field_150511_e;
public LanguageMap() {
- try {
@ -15,23 +15,23 @@
+
+ private static void injectLanguage(LanguageMap inst, InputStream inputStream){
+ final Map<String, String> map = parseLanguageFile(inputStream);
+ inst.languageList.putAll(map);
+ inst.lastUpdateTimeInMilliseconds = System.currentTimeMillis();
+ inst.field_74816_c.putAll(map);
+ inst.field_150511_e = System.currentTimeMillis();
+ }
+
+ private static Map<String, String> parseLanguageFile(InputStream inputstream) {
+ Map<String,String> languageList = Maps.newHashMap();
+ try {
JsonElement jsonelement = (JsonElement)(new Gson()).fromJson(new InputStreamReader(inputstream, StandardCharsets.UTF_8), JsonElement.class);
JsonObject jsonobject = JsonUtils.getJsonObject(jsonelement, "strings");
JsonObject jsonobject = JsonUtils.func_151210_l(jsonelement, "strings");
for(Entry<String, JsonElement> entry : jsonobject.entrySet()) {
String s = NUMERIC_VARIABLE_PATTERN.matcher(JsonUtils.getString(entry.getValue(), entry.getKey())).replaceAll("%$1s");
- this.languageList.put(entry.getKey(), s);
String s = field_111053_a.matcher(JsonUtils.func_151206_a(entry.getValue(), entry.getKey())).replaceAll("%$1s");
- this.field_74816_c.put(entry.getKey(), s);
+ languageList.put(entry.getKey(), s);
}
-
- this.lastUpdateTimeInMilliseconds = Util.func_211177_b();
- this.field_150511_e = Util.func_211177_b();
} catch (JsonParseException jsonparseexception) {
field_201045_a.error("Couldn't read strings from /assets/minecraft/lang/en_us.json", (Throwable)jsonparseexception);
}
@ -39,4 +39,4 @@
+ return languageList;
}
public static LanguageMap getInstance() {
public static LanguageMap func_74808_a() {

View File

@ -6,79 +6,81 @@
-public class Village {
+public class Village extends net.minecraftforge.common.capabilities.CapabilityProvider implements net.minecraftforge.common.extensions.IForgeVillage {
private World world;
private final List<VillageDoorInfo> villageDoorInfoList = Lists.<VillageDoorInfo>newArrayList();
private BlockPos centerHelper = BlockPos.ORIGIN;
private World field_75586_a;
private final List<VillageDoorInfo> field_75584_b = Lists.<VillageDoorInfo>newArrayList();
private BlockPos field_75585_c = BlockPos.field_177992_a;
@@ -40,15 +40,17 @@
private int tickCounter;
private int numVillagers;
private int noBreedTicks;
- private final Map<String, Integer> playerReputation = Maps.<String, Integer>newHashMap();
+ private final Map<UUID, Integer> playerReputation = Maps.<UUID, Integer>newHashMap();
private final List<Village.VillageAggressor> villageAgressors = Lists.<Village.VillageAggressor>newArrayList();
private int numIronGolems;
private int field_75581_g;
private int field_75588_h;
private int field_82694_i;
- private final Map<String, Integer> field_82693_j = Maps.<String, Integer>newHashMap();
+ private final Map<UUID, Integer> field_82693_j = Maps.<UUID, Integer>newHashMap();
private final List<Village.VillageAggressor> field_75589_i = Lists.<Village.VillageAggressor>newArrayList();
private int field_75587_j;
public Village() {
+ this.gatherCapabilities();
}
public Village(World worldIn) {
this.world = worldIn;
public Village(World p_i1675_1_) {
this.field_75586_a = p_i1675_1_;
+ this.gatherCapabilities();
}
public void setWorld(World worldIn) {
public void func_82691_a(World p_82691_1_) {
@@ -237,9 +239,9 @@
double d0 = Double.MAX_VALUE;
EntityPlayer entityplayer = null;
- for(String s : this.playerReputation.keySet()) {
+ for(UUID s : this.playerReputation.keySet()) {
if (this.isPlayerReputationTooLow(s)) {
- EntityPlayer entityplayer1 = this.world.getPlayerEntityByName(s);
+ EntityPlayer entityplayer1 = this.world.getPlayerEntityByUUID(s);
- for(String s : this.field_82693_j.keySet()) {
- if (this.func_82687_d(s)) {
- EntityPlayer entityplayer1 = this.field_75586_a.func_72924_a(s);
+ for(UUID s : this.field_82693_j.keySet()) {
+ if (this.isPlayerReputationTooLow(s)) {
+ EntityPlayer entityplayer1 = this.field_75586_a.func_152378_a(s);
if (entityplayer1 != null) {
double d1 = entityplayer1.getDistanceSq(villageDefender);
double d1 = entityplayer1.func_70068_e(p_82685_1_);
if (!(d1 > d0)) {
@@ -317,12 +319,32 @@
@@ -317,22 +319,47 @@
}
}
+ @Deprecated //Hasn't worked since 1.9, use UUID version below.
public int getPlayerReputation(String playerName) {
+ return this.getPlayerReputation(findUUID(playerName));
public int func_82684_a(String p_82684_1_) {
+ return this.getPlayerReputation(findUUID(p_82684_1_));
+ }
+
+ public int getPlayerReputation(UUID playerName)
+ public int getPlayerReputation(UUID p_82684_1_)
+ {
Integer integer = this.playerReputation.get(playerName);
Integer integer = this.field_82693_j.get(p_82684_1_);
return integer == null ? 0 : integer;
}
+
+ private UUID findUUID(String name)
+ {
+ if (this.world == null || this.world.getMinecraftServer() == null)
+ return EntityPlayer.getOfflineUUID(name);
+ GameProfile profile = this.world.getMinecraftServer().getPlayerProfileCache().getGameProfileForUsername(name);
+ return profile == null ? EntityPlayer.getOfflineUUID(name) : profile.getId();
+ if (this.field_75586_a == null || this.field_75586_a.func_73046_m() == null)
+ return EntityPlayer.func_175147_b(name);
+ GameProfile profile = this.field_75586_a.func_73046_m().func_152358_ax().func_152655_a(name);
+ return profile == null ? EntityPlayer.func_175147_b(name) : profile.getId();
+ }
+ @Deprecated //Hasn't worked since 1.9, use UUID version below.
public int modifyPlayerReputation(String playerName, int reputation) {
+ return this.modifyPlayerReputation(findUUID(playerName), reputation);
public int func_82688_a(String p_82688_1_, int p_82688_2_) {
- int i = this.func_82684_a(p_82688_1_);
+ return this.modifyPlayerReputation(findUUID(p_82688_1_), p_82688_2_);
+ }
+
+ public int modifyPlayerReputation(UUID playerName, int reputation)
+ public int modifyPlayerReputation(UUID p_82688_1_, int p_82688_2_)
+ {
int i = this.getPlayerReputation(playerName);
int j = MathHelper.clamp(i + reputation, -30, 10);
this.playerReputation.put(playerName, j);
@@ -330,9 +352,14 @@
+ int i = this.getPlayerReputation(p_82688_1_);
int j = MathHelper.func_76125_a(i + p_82688_2_, -30, 10);
this.field_82693_j.put(p_82688_1_, j);
return j;
}
public boolean isPlayerReputationTooLow(String playerName) {
- return this.getPlayerReputation(playerName) <= -15;
+ return this.isPlayerReputationTooLow(findUUID(playerName));
public boolean func_82687_d(String p_82687_1_) {
- return this.func_82684_a(p_82687_1_) <= -15;
+ return this.isPlayerReputationTooLow(findUUID(p_82687_1_));
}
+ public boolean isPlayerReputationTooLow(UUID uuid)
@ -86,65 +88,67 @@
+ return this.getPlayerReputation(uuid) <= -15;
+ }
+
public void readVillageDataFromNBT(NBTTagCompound compound) {
this.numVillagers = compound.getInteger("PopSize");
this.villageRadius = compound.getInteger("Radius");
public void func_82690_a(NBTTagCompound p_82690_1_) {
this.field_75588_h = p_82690_1_.func_74762_e("PopSize");
this.field_75583_e = p_82690_1_.func_74762_e("Radius");
@@ -354,17 +381,14 @@
for(int j = 0; j < nbttaglist1.size(); ++j) {
NBTTagCompound nbttagcompound1 = nbttaglist1.getCompoundTagAt(j);
- if (nbttagcompound1.hasKey("UUID") && this.world != null && this.world.getMinecraftServer() != null) {
- PlayerProfileCache playerprofilecache = this.world.getMinecraftServer().getPlayerProfileCache();
- GameProfile gameprofile = playerprofilecache.getProfileByUUID(UUID.fromString(nbttagcompound1.getString("UUID")));
NBTTagCompound nbttagcompound1 = nbttaglist1.func_150305_b(j);
- if (nbttagcompound1.func_74764_b("UUID") && this.field_75586_a != null && this.field_75586_a.func_73046_m() != null) {
- PlayerProfileCache playerprofilecache = this.field_75586_a.func_73046_m().func_152358_ax();
- GameProfile gameprofile = playerprofilecache.func_152652_a(UUID.fromString(nbttagcompound1.func_74779_i("UUID")));
- if (gameprofile != null) {
- this.playerReputation.put(gameprofile.getName(), nbttagcompound1.getInteger("S"));
- this.field_82693_j.put(gameprofile.getName(), nbttagcompound1.func_74762_e("S"));
- }
+ if (nbttagcompound1.hasKey("UUID")) {
+ this.playerReputation.put(UUID.fromString(nbttagcompound1.getString("UUID")), Integer.valueOf(nbttagcompound1.getInteger("S")));
+ if (nbttagcompound1.func_74764_b("UUID")) {
+ this.field_82693_j.put(UUID.fromString(nbttagcompound1.func_74779_i("UUID")), Integer.valueOf(nbttagcompound1.func_74762_e("S")));
} else {
- this.playerReputation.put(nbttagcompound1.getString("Name"), nbttagcompound1.getInteger("S"));
- this.field_82693_j.put(nbttagcompound1.func_74779_i("Name"), nbttagcompound1.func_74762_e("S"));
+ //World is never set here, so this will always be offline UUIDs, sadly there is no way to convert this.
+ this.playerReputation.put(findUUID(nbttagcompound1.getString("Name")), Integer.valueOf(nbttagcompound1.getInteger("S")));
+ this.field_82693_j.put(findUUID(nbttagcompound1.func_74779_i("Name")), Integer.valueOf(nbttagcompound1.func_74762_e("S")));
}
}
-
+ if (compound.hasKey("ForgeCaps")) this.deserializeCaps(compound.getCompoundTag("ForgeCaps"));
+ if (p_82690_1_.func_74764_b("ForgeCaps")) this.deserializeCaps(p_82690_1_.func_74775_l("ForgeCaps"));
}
public void writeVillageDataToNBT(NBTTagCompound compound) {
public void func_82689_b(NBTTagCompound p_82689_1_) {
@@ -396,14 +420,12 @@
compound.setTag("Doors", nbttaglist);
p_82689_1_.func_74782_a("Doors", nbttaglist);
NBTTagList nbttaglist1 = new NBTTagList();
- for(String s : this.playerReputation.keySet()) {
+ for(UUID s : this.playerReputation.keySet()) {
- for(String s : this.field_82693_j.keySet()) {
+ for(UUID s : this.field_82693_j.keySet()) {
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
- PlayerProfileCache playerprofilecache = this.world.getMinecraftServer().getPlayerProfileCache();
- PlayerProfileCache playerprofilecache = this.field_75586_a.func_73046_m().func_152358_ax();
try {
- GameProfile gameprofile = playerprofilecache.getGameProfileForUsername(s);
- GameProfile gameprofile = playerprofilecache.func_152655_a(s);
- if (gameprofile != null) {
- nbttagcompound1.setString("UUID", gameprofile.getId().toString());
- nbttagcompound1.func_74778_a("UUID", gameprofile.getId().toString());
+ {
+ nbttagcompound1.setString("UUID", s.toString());
nbttagcompound1.setInteger("S", this.playerReputation.get(s));
+ nbttagcompound1.func_74778_a("UUID", s.toString());
nbttagcompound1.func_74768_a("S", this.field_82693_j.get(s));
nbttaglist1.add((INBTBase)nbttagcompound1);
}
@@ -413,6 +435,8 @@
}
compound.setTag("Players", nbttaglist1);
p_82689_1_.func_74782_a("Players", nbttaglist1);
+ NBTTagCompound capTag = this.serializeCaps();
+ if (capTag != null) compound.setTag("ForgeCaps", capTag);
+ if (capTag != null) p_82689_1_.func_74782_a("ForgeCaps", capTag);
}
public void endMatingSeason() {
@@ -424,7 +448,7 @@
public void func_82692_h() {
@@ -424,8 +448,8 @@
}
public void setDefaultPlayerReputation(int defaultReputation) {
- for(String s : this.playerReputation.keySet()) {
+ for(UUID s : this.playerReputation.keySet()) {
this.modifyPlayerReputation(s, defaultReputation);
public void func_82683_b(int p_82683_1_) {
- for(String s : this.field_82693_j.keySet()) {
- this.func_82688_a(s, p_82683_1_);
+ for(UUID s : this.field_82693_j.keySet()) {
+ this.modifyPlayerReputation(s, p_82683_1_);
}
}

View File

@ -2,10 +2,10 @@
+++ b/net/minecraft/world/Explosion.java
@@ -92,7 +92,7 @@
BlockPos blockpos = new BlockPos(d4, d6, d8);
IBlockState iblockstate = this.world.getBlockState(blockpos);
IFluidState ifluidstate = this.world.func_204610_c(blockpos);
- float f2 = Math.max(iblockstate.getBlock().getExplosionResistance(), ifluidstate.func_210200_l());
+ float f2 = Math.max(iblockstate.getExplosionResistance(world, blockpos, exploder, this), ifluidstate.getExplosionResistance(world, blockpos, exploder, this));
IBlockState iblockstate = this.field_77287_j.func_180495_p(blockpos);
IFluidState ifluidstate = this.field_77287_j.func_204610_c(blockpos);
- float f2 = Math.max(iblockstate.func_177230_c().func_149638_a(), ifluidstate.func_210200_l());
+ float f2 = Math.max(iblockstate.getExplosionResistance(field_77287_j, blockpos, field_77283_e, this), ifluidstate.getExplosionResistance(field_77287_j, blockpos, field_77283_e, this));
if (f2 > 0.0F) {
if (this.exploder != null) {
f2 = this.exploder.getExplosionResistance(this, this.world, blockpos, iblockstate, ifluidstate, f2);
if (this.field_77283_e != null) {
f2 = this.field_77283_e.func_180428_a(this, this.field_77287_j, blockpos, iblockstate, ifluidstate, f2);

View File

@ -6,11 +6,11 @@
-public class Teleporter {
+public class Teleporter implements net.minecraftforge.common.util.ITeleporter {
private static final BlockPortal field_196236_a = (BlockPortal)Blocks.PORTAL;
protected final WorldServer world;
protected final Random random;
private static final BlockPortal field_196236_a = (BlockPortal)Blocks.field_150427_aO;
protected final WorldServer field_85192_a;
protected final Random field_77187_a;
@@ -334,4 +334,13 @@
this.lastUpdateTime = lastUpdate;
this.field_85087_d = p_i45747_3_;
}
}
+
@ -18,8 +18,8 @@
+ public void placeEntity(World world, Entity entity, float yaw)
+ {
+ if (entity instanceof EntityPlayerMP)
+ placeInPortal(entity, yaw);
+ func_180266_a(entity, yaw);
+ else
+ placeInExistingPortal(entity, yaw);
+ func_180620_b(entity, yaw);
+ }
}

View File

@ -12,15 +12,15 @@
+public abstract class World extends net.minecraftforge.common.capabilities.CapabilityProvider implements IWorld, IWorldReader, AutoCloseable, net.minecraftforge.common.extensions.IForgeWorld {
protected static final Logger field_195596_d = LogManager.getLogger();
private static final EnumFacing[] field_200007_a = EnumFacing.values();
private int seaLevel = 63;
private int field_181546_a = 63;
@@ -121,6 +122,7 @@
this.provider = providerIn;
this.isRemote = client;
this.worldBorder = providerIn.createWorldBorder();
this.field_73011_w = p_i45749_3_;
this.field_72995_K = p_i45749_5_;
this.field_175728_M = p_i45749_3_.func_177501_r();
+ perWorldStorage = new WorldSavedDataStorage((ISaveHandler)null);
}
public IWorld init() {
public IWorld func_175643_b() {
@@ -2397,4 +2399,31 @@
public abstract RecipeManager func_199532_z();
@ -32,18 +32,18 @@
+
+ protected void initCapabilities()
+ {
+ net.minecraftforge.common.capabilities.ICapabilityProvider parent = provider.initCapabilities();
+ net.minecraftforge.common.capabilities.ICapabilityProvider parent = field_73011_w.initCapabilities();
+ this.gatherCapabilities(parent);
+ net.minecraftforge.common.util.WorldCapabilityData data = (net.minecraftforge.common.util.WorldCapabilityData)perWorldStorage.func_201067_a(net.minecraftforge.common.util.WorldCapabilityData::new, net.minecraftforge.common.util.WorldCapabilityData.ID);
+ if (data == null)
+ {
+ capabilityData = new net.minecraftforge.common.util.WorldCapabilityData(getCapabilities());
+ perWorldStorage.setData(capabilityData.func_195925_e(), capabilityData);
+ perWorldStorage.func_75745_a(capabilityData.func_195925_e(), capabilityData);
}
+ else
+ {
+ capabilityData = data;
+ capabilityData.setCapabilities(provider, getCapabilities());
+ capabilityData.setCapabilities(field_73011_w, getCapabilities());
+ }
+ }
+

View File

@ -6,51 +6,51 @@
-public class WorldServer extends World implements IThreadListener {
+public class WorldServer extends World implements IThreadListener, net.minecraftforge.common.extensions.IForgeWorldServer {
private static final Logger LOGGER = LogManager.getLogger();
private final MinecraftServer server;
private final EntityTracker entityTracker;
private static final Logger field_147491_a = LogManager.getLogger();
private final MinecraftServer field_73061_a;
private final EntityTracker field_73062_L;
@@ -105,27 +105,36 @@
protected final VillageSiege villageSiege = new VillageSiege(this);
ObjectLinkedOpenHashSet<BlockEventData> blockEventQueue = new ObjectLinkedOpenHashSet<BlockEventData>();
protected final VillageSiege field_175740_d = new VillageSiege(this);
ObjectLinkedOpenHashSet<BlockEventData> field_147490_S = new ObjectLinkedOpenHashSet<BlockEventData>();
private boolean field_211159_Q;
+
+ /** Stores the recently processed (lighting) chunks */
+ protected java.util.Set<ChunkPos> doneChunks = new java.util.HashSet<ChunkPos>();
+ public List<Teleporter> customTeleporters = new java.util.ArrayList<Teleporter>();
public WorldServer(MinecraftServer server, ISaveHandler saveHandlerIn, WorldInfo info, int dimensionId, Profiler profilerIn) {
- super(saveHandlerIn, info, DimensionType.getById(dimensionId).createDimension(), profilerIn, false);
+ super(saveHandlerIn, info,net.minecraftforge.common.DimensionManager.createProviderFor(dimensionId), profilerIn, false);
this.server = server;
this.entityTracker = new EntityTracker(this);
this.playerChunkMap = new PlayerChunkMap(this);
public WorldServer(MinecraftServer p_i45921_1_, ISaveHandler p_i45921_2_, WorldInfo p_i45921_3_, int p_i45921_4_, Profiler p_i45921_5_) {
- super(p_i45921_2_, p_i45921_3_, DimensionType.func_186069_a(p_i45921_4_).func_186070_d(), p_i45921_5_, false);
+ super(p_i45921_2_, p_i45921_3_,net.minecraftforge.common.DimensionManager.createProviderFor(p_i45921_4_), p_i45921_5_, false);
this.field_73061_a = p_i45921_1_;
this.field_73062_L = new EntityTracker(this);
this.field_73063_M = new PlayerChunkMap(this);
+ // Guarantee the dimension ID was not reset by the provider
+ int providerDim = this.provider.getId();
this.provider.setWorld(this);
+ this.provider.setId(providerDim);
this.chunkProvider = this.createChunkProvider();
+ perWorldStorage = new WorldSavedDataStorage(new net.minecraftforge.common.WorldSpecificSaveHandler((WorldServer)this, saveHandlerIn));
this.worldTeleporter = new Teleporter(this);
this.calculateInitialSkylight();
this.calculateInitialWeather();
this.getWorldBorder().setSize(server.getMaxWorldSize());
+ net.minecraftforge.common.DimensionManager.setWorld(dimensionId, this, server);
+ int providerDim = this.field_73011_w.getId();
this.field_73011_w.func_76558_a(this);
+ this.field_73011_w.setId(providerDim);
this.field_73020_y = this.func_72970_h();
+ perWorldStorage = new WorldSavedDataStorage(new net.minecraftforge.common.WorldSpecificSaveHandler((WorldServer)this, p_i45921_2_));
this.field_85177_Q = new Teleporter(this);
this.func_72966_v();
this.func_72947_a();
this.func_175723_af().func_177725_a(p_i45921_1_.func_175580_aG());
+ net.minecraftforge.common.DimensionManager.setWorld(p_i45921_4_, this, p_i45921_1_);
}
public IWorld init() {
this.mapStorage = new WorldSavedDataStorage(this.saveHandler);
String s = VillageCollection.fileNameForProvider(this.provider);
- VillageCollection villagecollection = (VillageCollection)this.mapStorage.func_201067_a(VillageCollection::new, s);
public IWorld func_175643_b() {
this.field_72988_C = new WorldSavedDataStorage(this.field_73019_z);
String s = VillageCollection.func_176062_a(this.field_73011_w);
- VillageCollection villagecollection = (VillageCollection)this.field_72988_C.func_201067_a(VillageCollection::new, s);
+ VillageCollection villagecollection = (VillageCollection)this.perWorldStorage.func_201067_a(VillageCollection::new, s);
if (villagecollection == null) {
this.villageCollection = new VillageCollection(this);
- this.mapStorage.setData(s, this.villageCollection);
+ this.perWorldStorage.setData(s, this.villageCollection);
this.field_72982_D = new VillageCollection(this);
- this.field_72988_C.func_75745_a(s, this.field_72982_D);
+ this.perWorldStorage.func_75745_a(s, this.field_72982_D);
} else {
this.villageCollection = villagecollection;
this.villageCollection.setWorldsForAll(this);
this.field_72982_D = villagecollection;
this.field_72982_D.func_82566_a(this);
@@ -150,6 +159,7 @@
this.getWorldBorder().setTransition(this.worldInfo.getBorderSize());
this.func_175723_af().func_177750_a(this.field_72986_A.func_176137_E());
}
+ this.initCapabilities();
@ -58,137 +58,137 @@
}
@@ -163,8 +173,8 @@
this.chunkProvider.func_201711_g().func_202090_b().update();
if (this.areAllPlayersAsleep()) {
if (this.getGameRules().getBoolean("doDaylightCycle")) {
- long i = this.worldInfo.getWorldTime() + 24000L;
- this.worldInfo.setWorldTime(i - i % 24000L);
+ long i = this.getWorldTime() + 24000L;
+ this.setWorldTime(i - i % 24000L);
this.field_73020_y.func_201711_g().func_202090_b().func_73660_a();
if (this.func_73056_e()) {
if (this.func_82736_K().func_82766_b("doDaylightCycle")) {
- long i = this.field_72986_A.func_76073_f() + 24000L;
- this.field_72986_A.func_76068_b(i - i % 24000L);
+ long i = this.func_72820_D() + 24000L;
+ this.func_72877_b(i - i % 24000L);
}
this.wakeAllPlayers();
this.func_73053_d();
@@ -185,7 +195,7 @@
this.worldInfo.setWorldTotalTime(this.worldInfo.getWorldTotalTime() + 1L);
if (this.getGameRules().getBoolean("doDaylightCycle")) {
- this.worldInfo.setWorldTime(this.worldInfo.getWorldTime() + 1L);
+ this.worldInfo.setWorldTime(this.getWorldTime() + 1L);
this.field_72986_A.func_82572_b(this.field_72986_A.func_82573_f() + 1L);
if (this.func_82736_K().func_82766_b("doDaylightCycle")) {
- this.field_72986_A.func_76068_b(this.field_72986_A.func_76073_f() + 1L);
+ this.field_72986_A.func_76068_b(this.func_72820_D() + 1L);
}
this.profiler.endStartSection("tickPending");
this.field_72984_F.func_76318_c("tickPending");
@@ -199,6 +209,10 @@
this.villageSiege.tick();
this.profiler.endStartSection("portalForcer");
this.worldTeleporter.removeStalePortalLocations(this.getTotalWorldTime());
this.field_175740_d.func_75528_a();
this.field_72984_F.func_76318_c("portalForcer");
this.field_85177_Q.func_85189_a(this.func_82737_E());
+ for (Teleporter tele : customTeleporters)
+ {
+ tele.removeStalePortalLocations(getTotalWorldTime());
+ tele.func_85189_a(func_82737_E());
+ }
this.profiler.endSection();
this.sendQueuedBlockEvents();
this.field_72984_F.func_76319_b();
this.func_147488_Z();
this.field_211159_Q = false;
@@ -211,11 +225,13 @@
@Nullable
public Biome.SpawnListEntry getSpawnListEntryForTypeAt(EnumCreatureType creatureType, BlockPos pos) {
List<Biome.SpawnListEntry> list = this.getChunkProvider().getPossibleCreatures(creatureType, pos);
+ list = net.minecraftforge.event.ForgeEventFactory.getPotentialSpawns(this, creatureType, pos, list);
return list.isEmpty() ? null : (Biome.SpawnListEntry)WeightedRandom.getRandomItem(this.rand, list);
public Biome.SpawnListEntry func_175734_a(EnumCreatureType p_175734_1_, BlockPos p_175734_2_) {
List<Biome.SpawnListEntry> list = this.func_72863_F().func_177458_a(p_175734_1_, p_175734_2_);
+ list = net.minecraftforge.event.ForgeEventFactory.getPotentialSpawns(this, p_175734_1_, p_175734_2_, list);
return list.isEmpty() ? null : (Biome.SpawnListEntry)WeightedRandom.func_76271_a(this.field_73012_v, list);
}
public boolean canCreatureTypeSpawnHere(EnumCreatureType creatureType, Biome.SpawnListEntry spawnListEntry, BlockPos pos) {
List<Biome.SpawnListEntry> list = this.getChunkProvider().getPossibleCreatures(creatureType, pos);
+ list = net.minecraftforge.event.ForgeEventFactory.getPotentialSpawns(this, creatureType, pos, list);
return list != null && !list.isEmpty() ? list.contains(spawnListEntry) : false;
public boolean func_175732_a(EnumCreatureType p_175732_1_, Biome.SpawnListEntry p_175732_2_, BlockPos p_175732_3_) {
List<Biome.SpawnListEntry> list = this.func_72863_F().func_177458_a(p_175732_1_, p_175732_3_);
+ list = net.minecraftforge.event.ForgeEventFactory.getPotentialSpawns(this, p_175732_1_, p_175732_3_, list);
return list != null && !list.isEmpty() ? list.contains(p_175732_2_) : false;
}
@@ -256,10 +272,7 @@
}
private void resetRainAndThunder() {
- this.worldInfo.setRainTime(0);
- this.worldInfo.setRaining(false);
- this.worldInfo.setThunderTime(0);
- this.worldInfo.setThundering(false);
+ this.provider.resetRainAndThunder();
private void func_73051_P() {
- this.field_72986_A.func_76080_g(0);
- this.field_72986_A.func_76084_b(false);
- this.field_72986_A.func_76090_f(0);
- this.field_72986_A.func_76069_a(false);
+ this.field_73011_w.resetRainAndThunder();
}
public boolean areAllPlayersAsleep() {
public boolean func_73056_e() {
@@ -346,7 +359,7 @@
this.profiler.endStartSection("tickChunk");
chunk.onTick(false);
this.profiler.endStartSection("thunder");
- if (flag && flag1 && this.rand.nextInt(100000) == 0) {
+ if (this.provider.canDoLightning(chunk) && flag && flag1 && this.rand.nextInt(100000) == 0) {
this.updateLCG = this.updateLCG * 3 + 1013904223;
int l = this.updateLCG >> 2;
BlockPos blockpos = this.adjustPosToNearbyEntity(new BlockPos(j + (l & 15), 0, k + (l >> 8 & 15)));
this.field_72984_F.func_76318_c("tickChunk");
chunk.func_150804_b(false);
this.field_72984_F.func_76318_c("thunder");
- if (flag && flag1 && this.field_73012_v.nextInt(100000) == 0) {
+ if (this.field_73011_w.canDoLightning(chunk) && flag && flag1 && this.field_73012_v.nextInt(100000) == 0) {
this.field_73005_l = this.field_73005_l * 3 + 1013904223;
int l = this.field_73005_l >> 2;
BlockPos blockpos = this.func_175736_a(new BlockPos(j + (l & 15), 0, k + (l >> 8 & 15)));
@@ -366,12 +379,13 @@
}
this.profiler.endStartSection("iceandsnow");
- if (this.rand.nextInt(16) == 0) {
+ if (this.provider.canDoRainSnowIce(chunk) && this.rand.nextInt(16) == 0) {
this.updateLCG = this.updateLCG * 3 + 1013904223;
int j2 = this.updateLCG >> 2;
this.field_72984_F.func_76318_c("iceandsnow");
- if (this.field_73012_v.nextInt(16) == 0) {
+ if (this.field_73011_w.canDoRainSnowIce(chunk) && this.field_73012_v.nextInt(16) == 0) {
this.field_73005_l = this.field_73005_l * 3 + 1013904223;
int j2 = this.field_73005_l >> 2;
BlockPos blockpos1 = this.func_205770_a(Heightmap.Type.MOTION_BLOCKING, new BlockPos(j + (j2 & 15), 0, k + (j2 >> 8 & 15)));
BlockPos blockpos2 = blockpos1.down();
Biome biome = this.getBiome(blockpos1);
+ if (this.isAreaLoaded(blockpos2, 1, false)) // Forge: check area to avoid loading neighbors in unloaded chunks
BlockPos blockpos2 = blockpos1.func_177977_b();
Biome biome = this.func_180494_b(blockpos1);
+ if (this.func_175648_a(blockpos2, 1, false)) // Forge: check area to avoid loading neighbors in unloaded chunks
if (biome.func_201848_a(this, blockpos2)) {
this.setBlockState(blockpos2, Blocks.ICE.getDefaultState());
this.func_175656_a(blockpos2, Blocks.field_150432_aD.func_176223_P());
}
@@ -545,6 +559,11 @@
}
public boolean isBlockModifiable(EntityPlayer player, BlockPos pos) {
+ return super.isBlockModifiable(player, pos);
public boolean func_175660_a(EntityPlayer p_175660_1_, BlockPos p_175660_2_) {
+ return super.func_175660_a(p_175660_1_, p_175660_2_);
+ }
+
+ public boolean canMineBlockBody(EntityPlayer player, BlockPos pos)
+ public boolean canMineBlockBody(EntityPlayer p_175660_1_, BlockPos p_175660_2_)
+ {
return !this.server.isBlockProtected(this, pos, player) && this.getWorldBorder().contains(pos);
return !this.field_73061_a.func_175579_a(this, p_175660_2_, p_175660_1_) && this.func_175723_af().func_177746_a(p_175660_2_);
}
@@ -594,6 +613,7 @@
} else if (this.worldInfo.getTerrainType() == WorldType.DEBUG_ALL_BLOCK_STATES) {
this.worldInfo.setSpawn(BlockPos.ORIGIN.up());
} else if (this.field_72986_A.func_76067_t() == WorldType.field_180272_g) {
this.field_72986_A.func_176143_a(BlockPos.field_177992_a.func_177984_a());
} else {
+ if (net.minecraftforge.event.ForgeEventFactory.onCreateWorldSpawn(this, settings)) return;
BiomeProvider biomeprovider = this.chunkProvider.func_201711_g().func_202090_b();
List<Biome> list = biomeprovider.getBiomesToSpawnIn();
Random random = new Random(this.getSeed());
+ if (net.minecraftforge.event.ForgeEventFactory.onCreateWorldSpawn(this, p_73052_1_)) return;
BiomeProvider biomeprovider = this.field_73020_y.func_201711_g().func_202090_b();
List<Biome> list = biomeprovider.func_76932_a();
Random random = new Random(this.func_72905_C());
@@ -676,6 +696,7 @@
progressCallback.func_200209_c(new TextComponentTranslation("menu.savingChunks", new Object[0]));
p_73044_2_.func_200209_c(new TextComponentTranslation("menu.savingChunks", new Object[0]));
}
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Save(this));
chunkproviderserver.saveChunks(all);
chunkproviderserver.func_186027_a(p_73044_1_);
for(Chunk chunk : Lists.newArrayList(chunkproviderserver.getLoadedChunks())) {
for(Chunk chunk : Lists.newArrayList(chunkproviderserver.func_189548_a())) {
@@ -715,6 +736,7 @@
this.worldInfo.func_201356_c(this.server.func_201300_aS().func_201380_c());
this.saveHandler.saveWorldInfoWithPlayer(this.worldInfo, this.server.getPlayerList().getHostPlayerData());
this.mapStorage.saveAllData();
+ this.perWorldStorage.saveAllData();
this.field_72986_A.func_201356_c(this.field_73061_a.func_201300_aS().func_201380_c());
this.field_73019_z.func_75755_a(this.field_72986_A, this.field_73061_a.func_184103_al().func_72378_q());
this.field_72988_C.func_75744_a();
+ this.perWorldStorage.func_75744_a();
}
public boolean spawnEntity(Entity entityIn) {
public boolean func_72838_d(Entity p_72838_1_) {
@@ -723,7 +745,7 @@
public void loadEntities(Collection<Entity> entityCollection) {
for(Entity entity : Lists.newArrayList(entityCollection)) {
- if (this.canAddEntity(entity)) {
+ if (this.canAddEntity(entity) && !net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityJoinWorldEvent(entity, this))) {
this.loadedEntityList.add(entity);
this.onEntityAdded(entity);
public void func_175650_b(Collection<Entity> p_175650_1_) {
for(Entity entity : Lists.newArrayList(p_175650_1_)) {
- if (this.func_184165_i(entity)) {
+ if (this.func_184165_i(entity) && !net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityJoinWorldEvent(entity, this))) {
this.field_72996_f.add(entity);
this.func_72923_a(entity);
}
@@ -785,7 +807,7 @@
public boolean addWeatherEffect(Entity entityIn) {
if (super.addWeatherEffect(entityIn)) {
- this.server.getPlayerList().sendToAllNearExcept((EntityPlayer)null, entityIn.posX, entityIn.posY, entityIn.posZ, 512.0D, this.provider.getDimensionType().getId(), new SPacketSpawnGlobalEntity(entityIn));
+ this.server.getPlayerList().sendToAllNearExcept((EntityPlayer)null, entityIn.posX, entityIn.posY, entityIn.posZ, 512.0D, this.provider.getId(), new SPacketSpawnGlobalEntity(entityIn));
public boolean func_72942_c(Entity p_72942_1_) {
if (super.func_72942_c(p_72942_1_)) {
- this.field_73061_a.func_184103_al().func_148543_a((EntityPlayer)null, p_72942_1_.field_70165_t, p_72942_1_.field_70163_u, p_72942_1_.field_70161_v, 512.0D, this.field_73011_w.func_186058_p().func_186068_a(), new SPacketSpawnGlobalEntity(p_72942_1_));
+ this.field_73061_a.func_184103_al().func_148543_a((EntityPlayer)null, p_72942_1_.field_70165_t, p_72942_1_.field_70163_u, p_72942_1_.field_70161_v, 512.0D, this.field_73011_w.getId(), new SPacketSpawnGlobalEntity(p_72942_1_));
return true;
} else {
return false;
@ -201,50 +201,50 @@
explosion.func_199592_a(p_211529_2_);
}
@@ -829,7 +852,7 @@
while(!this.blockEventQueue.isEmpty()) {
BlockEventData blockeventdata = this.blockEventQueue.removeFirst();
if (this.fireBlockEvent(blockeventdata)) {
- this.server.getPlayerList().sendToAllNearExcept((EntityPlayer)null, (double)blockeventdata.getPosition().getX(), (double)blockeventdata.getPosition().getY(), (double)blockeventdata.getPosition().getZ(), 64.0D, this.provider.getDimensionType().getId(), new SPacketBlockAction(blockeventdata.getPosition(), blockeventdata.getBlock(), blockeventdata.getEventID(), blockeventdata.getEventParameter()));
+ this.server.getPlayerList().sendToAllNearExcept((EntityPlayer)null, (double)blockeventdata.getPosition().getX(), (double)blockeventdata.getPosition().getY(), (double)blockeventdata.getPosition().getZ(), 64.0D, this.provider.getId(), new SPacketBlockAction(blockeventdata.getPosition(), blockeventdata.getBlock(), blockeventdata.getEventID(), blockeventdata.getEventParameter()));
while(!this.field_147490_S.isEmpty()) {
BlockEventData blockeventdata = this.field_147490_S.removeFirst();
if (this.func_147485_a(blockeventdata)) {
- this.field_73061_a.func_184103_al().func_148543_a((EntityPlayer)null, (double)blockeventdata.func_180328_a().func_177958_n(), (double)blockeventdata.func_180328_a().func_177956_o(), (double)blockeventdata.func_180328_a().func_177952_p(), 64.0D, this.field_73011_w.func_186058_p().func_186068_a(), new SPacketBlockAction(blockeventdata.func_180328_a(), blockeventdata.func_151337_f(), blockeventdata.func_151339_d(), blockeventdata.func_151338_e()));
+ this.field_73061_a.func_184103_al().func_148543_a((EntityPlayer)null, (double)blockeventdata.func_180328_a().func_177958_n(), (double)blockeventdata.func_180328_a().func_177956_o(), (double)blockeventdata.func_180328_a().func_177952_p(), 64.0D, this.field_73011_w.getId(), new SPacketBlockAction(blockeventdata.func_180328_a(), blockeventdata.func_151337_f(), blockeventdata.func_151339_d(), blockeventdata.func_151338_e()));
}
}
@@ -849,22 +872,26 @@
boolean flag = this.isRaining();
super.updateWeather();
if (this.prevRainingStrength != this.rainingStrength) {
- this.server.getPlayerList().sendPacketToAllPlayersInDimension(new SPacketChangeGameState(7, this.rainingStrength), this.provider.getDimensionType().getId());
+ this.server.getPlayerList().sendPacketToAllPlayersInDimension(new SPacketChangeGameState(7, this.rainingStrength), this.provider.getId());
boolean flag = this.func_72896_J();
super.func_72979_l();
if (this.field_73003_n != this.field_73004_o) {
- this.field_73061_a.func_184103_al().func_148537_a(new SPacketChangeGameState(7, this.field_73004_o), this.field_73011_w.func_186058_p().func_186068_a());
+ this.field_73061_a.func_184103_al().func_148537_a(new SPacketChangeGameState(7, this.field_73004_o), this.field_73011_w.getId());
}
if (this.prevThunderingStrength != this.thunderingStrength) {
- this.server.getPlayerList().sendPacketToAllPlayersInDimension(new SPacketChangeGameState(8, this.thunderingStrength), this.provider.getDimensionType().getId());
+ this.server.getPlayerList().sendPacketToAllPlayersInDimension(new SPacketChangeGameState(8, this.thunderingStrength), this.provider.getId());
if (this.field_73018_p != this.field_73017_q) {
- this.field_73061_a.func_184103_al().func_148537_a(new SPacketChangeGameState(8, this.field_73017_q), this.field_73011_w.func_186058_p().func_186068_a());
+ this.field_73061_a.func_184103_al().func_148537_a(new SPacketChangeGameState(8, this.field_73017_q), this.field_73011_w.getId());
}
+ /* The function in use here has been replaced in order to only send the weather info to players in the correct dimension,
+ * rather than to all players on the server. This is what causes the client-side rain, as the
+ * client believes that it has started raining locally, rather than in another dimension.
+ */
if (flag != this.isRaining()) {
if (flag != this.func_72896_J()) {
if (flag) {
- this.server.getPlayerList().sendPacketToAllPlayers(new SPacketChangeGameState(2, 0.0F));
+ this.server.getPlayerList().sendPacketToAllPlayersInDimension(new SPacketChangeGameState(2, 0.0F), this.provider.getId());
- this.field_73061_a.func_184103_al().func_148540_a(new SPacketChangeGameState(2, 0.0F));
+ this.field_73061_a.func_184103_al().func_148537_a(new SPacketChangeGameState(2, 0.0F), this.field_73011_w.getId());
} else {
- this.server.getPlayerList().sendPacketToAllPlayers(new SPacketChangeGameState(1, 0.0F));
+ this.server.getPlayerList().sendPacketToAllPlayersInDimension(new SPacketChangeGameState(1, 0.0F), this.provider.getId());
- this.field_73061_a.func_184103_al().func_148540_a(new SPacketChangeGameState(1, 0.0F));
+ this.field_73061_a.func_184103_al().func_148537_a(new SPacketChangeGameState(1, 0.0F), this.field_73011_w.getId());
}
- this.server.getPlayerList().sendPacketToAllPlayers(new SPacketChangeGameState(7, this.rainingStrength));
- this.server.getPlayerList().sendPacketToAllPlayers(new SPacketChangeGameState(8, this.thunderingStrength));
+ this.server.getPlayerList().sendPacketToAllPlayersInDimension(new SPacketChangeGameState(7, this.rainingStrength), this.provider.getId());
+ this.server.getPlayerList().sendPacketToAllPlayersInDimension(new SPacketChangeGameState(8, this.thunderingStrength), this.provider.getId());
- this.field_73061_a.func_184103_al().func_148540_a(new SPacketChangeGameState(7, this.field_73004_o));
- this.field_73061_a.func_184103_al().func_148540_a(new SPacketChangeGameState(8, this.field_73017_q));
+ this.field_73061_a.func_184103_al().func_148537_a(new SPacketChangeGameState(7, this.field_73004_o), this.field_73011_w.getId());
+ this.field_73061_a.func_184103_al().func_148537_a(new SPacketChangeGameState(8, this.field_73017_q), this.field_73011_w.getId());
}
}
@@ -957,4 +984,12 @@
public NetworkTagManager func_205772_D() {
return this.server.func_199731_aO();
return this.field_73061_a.func_199731_aO();
}
+
+ private long[] tickTime = new long[100];

View File

@ -1,7 +1,7 @@
--- a/net/minecraft/world/WorldServerMulti.java
+++ b/net/minecraft/world/WorldServerMulti.java
@@ -60,6 +60,7 @@
this.villageCollection.setWorldsForAll(this);
this.field_72982_D.func_82566_a(this);
}
+ this.initCapabilities();

View File

@ -6,6 +6,6 @@
-public abstract class Biome {
+public abstract class Biome extends net.minecraftforge.registries.ForgeRegistryEntry<Biome> {
public static final Logger LOGGER = LogManager.getLogger();
public static final Logger field_150586_aC = LogManager.getLogger();
public static final WorldCarver<ProbabilityConfig> field_201907_b = new CaveWorldCarver();
public static final WorldCarver<ProbabilityConfig> field_201908_c = new NetherCaveWorldCarver();

View File

@ -6,13 +6,13 @@
-public class Chunk implements IChunk {
+public class Chunk extends net.minecraftforge.common.capabilities.CapabilityProvider implements IChunk, net.minecraftforge.common.extensions.IForgeChunk {
private static final Logger LOGGER = LogManager.getLogger();
public static final ChunkSection NULL_BLOCK_STORAGE = null;
private final ChunkSection[] storageArrays;
private static final Logger field_150817_t = LogManager.getLogger();
public static final ChunkSection field_186036_a = null;
private final ChunkSection[] field_76652_q;
@@ -125,6 +125,7 @@
this.field_201621_s = p_i49379_6_;
this.field_205325_u = p_i49379_7_;
this.inhabitedTime = p_i49379_8_;
this.field_111204_q = p_i49379_8_;
+ this.gatherCapabilities();
}

View File

@ -2,13 +2,13 @@
+++ b/net/minecraft/world/chunk/storage/AnvilChunkLoader.java
@@ -445,6 +445,16 @@
compound.setTag("Heightmaps", nbttagcompound2);
compound.setTag("Structures", this.func_202160_a(chunkIn.x, chunkIn.z, chunkIn.func_201609_c(), chunkIn.func_201604_d()));
p_75820_3_.func_74782_a("Heightmaps", nbttagcompound2);
p_75820_3_.func_74782_a("Structures", this.func_202160_a(p_75820_1_.field_76635_g, p_75820_1_.field_76647_h, p_75820_1_.func_201609_c(), p_75820_1_.func_201604_d()));
+
+ try
+ {
+ final NBTTagCompound capTag = chunkIn.writeCapsToNBT();
+ if (capTag != null) compound.setTag("ForgeCaps", capTag);
+ final NBTTagCompound capTag = p_75820_1_.writeCapsToNBT();
+ if (capTag != null) p_75820_3_.func_74782_a("ForgeCaps", capTag);
+ }
+ catch (Exception exception)
+ {
@ -16,13 +16,13 @@
+ }
}
private Chunk readChunkFromNBT(IWorld worldIn, NBTTagCompound compound) {
private Chunk func_75823_a(IWorld p_75823_1_, NBTTagCompound p_75823_2_) {
@@ -511,6 +521,10 @@
chunk.setModified(true);
chunk.func_177427_f(true);
}
+ if (compound.hasKey("ForgeCaps")) {
+ chunk.readCapsFromNBT(compound.getCompoundTag("ForgeCaps"));
+ if (p_75823_2_.func_74764_b("ForgeCaps")) {
+ chunk.readCapsFromNBT(p_75823_2_.func_74775_l("ForgeCaps"));
+ }
+
return chunk;
@ -34,6 +34,6 @@
}
+
+ public int getPendingSaveCount() {
+ return this.chunksToSave.size();
+ return this.field_75828_a.size();
+ }
}

Some files were not shown because too many files have changed in this diff Show More