mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-14 01:04:24 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
03082c361a | ||
|
|
65372e3123 | ||
|
|
0f923fa51f | ||
|
|
d1e3567c6b | ||
|
|
af75547d37 | ||
|
|
37be3aff2d | ||
|
|
b9b17d8331 | ||
|
|
2a433a5c8c | ||
|
|
e344fd08a5 | ||
|
|
0484f695fb | ||
|
|
e55bd86dff | ||
|
|
b1247df4dc | ||
|
|
91dda36b08 | ||
|
|
ac19d1bf2b | ||
|
|
e0e0302ece | ||
|
|
6eb3e20abb | ||
|
|
738491c25d | ||
|
|
2686b7a9ab | ||
|
|
4b93e3a224 | ||
|
|
873c490470 | ||
|
|
11e3281b3f | ||
|
|
ce6c664acd |
No files matched your search
+3
-3
@@ -55,7 +55,7 @@ ext {
|
||||
MAPPING_CHANNEL = 'snapshot'
|
||||
MAPPING_VERSION = '20200514-1.16'
|
||||
MC_VERSION = '1.16.3'
|
||||
MCP_VERSION = '20200910.110331'
|
||||
MCP_VERSION = '20200911.084530'
|
||||
}
|
||||
|
||||
project(':mcp') {
|
||||
@@ -197,7 +197,7 @@ project(':forge') {
|
||||
}
|
||||
|
||||
ext {
|
||||
SPEC_VERSION = '34.0' // This is overwritten by git tag, but here so dev time doesnt explode
|
||||
SPEC_VERSION = '34.1' // This is overwritten by git tag, but here so dev time doesnt explode
|
||||
// The new versioning sceme is <MCVersion>-<ForgeMC>.<RB>.<CommitsSinceRB>
|
||||
// ForgeMC is a unique identifier for every MC version we have supported.
|
||||
// Essentially, the same as the old, except dropping the first number, and the builds are no longer unique.
|
||||
@@ -451,7 +451,7 @@ project(':forge') {
|
||||
installer 'org.apache.logging.log4j:log4j-core:2.11.2'
|
||||
installer 'net.minecrell:terminalconsoleappender:1.2.+'
|
||||
installer 'net.sf.jopt-simple:jopt-simple:5.0.4'
|
||||
installer 'org.spongepowered:mixin:0.8'
|
||||
installer 'org.spongepowered:mixin:0.8.1'
|
||||
fmllauncherImplementation 'com.google.guava:guava:21.0'
|
||||
fmllauncherImplementation 'com.google.code.gson:gson:2.8.0'
|
||||
fmllauncherImplementation 'org.lwjgl:lwjgl:3.2.2'
|
||||
|
||||
+2
-2
@@ -2,8 +2,8 @@
|
||||
|
||||
MinecraftForge
|
||||
=============
|
||||
[](https://files.minecraftforge.net)
|
||||
[](https://files.minecraftforge.net)
|
||||
[](https://files.minecraftforge.net) [](https://discord.gg/UvedJ9m) [](https://www.patreon.com/LexManos)
|
||||
|
||||
Forge is a free, open-source modding API all of your favourite mods use!
|
||||
|
||||
@@ -77,21 +77,23 @@
|
||||
if (effect != null) {
|
||||
EffectInstance effectinstance = new EffectInstance(effect, p_147260_1_.func_180755_e(), p_147260_1_.func_149428_f(), p_147260_1_.func_186984_g(), p_147260_1_.func_179707_f(), p_147260_1_.func_205527_h());
|
||||
effectinstance.func_100012_b(p_147260_1_.func_149429_c());
|
||||
@@ -1388,11 +1401,12 @@
|
||||
@@ -1388,11 +1401,14 @@
|
||||
public void func_199723_a(STagsListPacket p_199723_1_) {
|
||||
PacketThreadUtil.func_218797_a(p_199723_1_, this, this.field_147299_f);
|
||||
ITagCollectionSupplier itagcollectionsupplier = p_199723_1_.func_199858_a();
|
||||
- Multimap<ResourceLocation, ResourceLocation> multimap = TagRegistryManager.func_242198_b(itagcollectionsupplier);
|
||||
+ Multimap<ResourceLocation, ResourceLocation> multimap = TagRegistryManager.validateVanillaTags(itagcollectionsupplier);
|
||||
+ boolean vanillaConnection = net.minecraftforge.fml.network.NetworkHooks.isVanillaConnection(field_147302_e);
|
||||
+ Multimap<ResourceLocation, ResourceLocation> multimap = vanillaConnection ? TagRegistryManager.func_242198_b(net.minecraftforge.common.ForgeTagHandler.withNoCustom(itagcollectionsupplier)) : TagRegistryManager.validateVanillaTags(itagcollectionsupplier);//Forge: If we are connecting to vanilla validate all tags to properly validate custom tags the client may "require", and if we are connecting to forge only validate the vanilla tag types as the custom tag types get synced in a separate packet so may still arrive
|
||||
if (!multimap.isEmpty()) {
|
||||
field_147301_d.warn("Incomplete server tags, disconnecting. Missing: {}", (Object)multimap);
|
||||
this.field_147302_e.func_150718_a(new TranslationTextComponent("multiplayer.disconnect.missing_tags"));
|
||||
} else {
|
||||
+ net.minecraftforge.common.ForgeTagHandler.resetCachedTagCollections();
|
||||
+ net.minecraftforge.common.ForgeTagHandler.resetCachedTagCollections(true, vanillaConnection);
|
||||
+ itagcollectionsupplier = ITagCollectionSupplier.reinjectOptionalTags(itagcollectionsupplier);
|
||||
this.field_199725_m = itagcollectionsupplier;
|
||||
if (!this.field_147302_e.func_150731_c()) {
|
||||
itagcollectionsupplier.func_242212_e();
|
||||
@@ -1883,10 +1897,12 @@
|
||||
@@ -1883,10 +1899,12 @@
|
||||
int l5 = packetbuffer.readInt();
|
||||
this.field_147299_f.field_184132_p.field_229018_q_.func_229022_a_(blockpos8, l3, s10, l5);
|
||||
} else {
|
||||
|
||||
@@ -1,6 +1,18 @@
|
||||
--- a/net/minecraft/client/renderer/WorldRenderer.java
|
||||
+++ b/net/minecraft/client/renderer/WorldRenderer.java
|
||||
@@ -830,7 +830,7 @@
|
||||
@@ -222,6 +222,11 @@
|
||||
}
|
||||
|
||||
private void func_228438_a_(LightTexture p_228438_1_, float p_228438_2_, double p_228438_3_, double p_228438_5_, double p_228438_7_) {
|
||||
+ net.minecraftforge.client.IWeatherRenderHandler renderHandler = field_72769_h.func_239132_a_().getWeatherRenderHandler();
|
||||
+ if (renderHandler != null) {
|
||||
+ renderHandler.render(field_72773_u, p_228438_2_, field_72769_h, field_72777_q, p_228438_1_, p_228438_3_, p_228438_5_, p_228438_7_);
|
||||
+ return;
|
||||
+ }
|
||||
float f = this.field_72777_q.field_71441_e.func_72867_j(p_228438_2_);
|
||||
if (!(f <= 0.0F)) {
|
||||
p_228438_1_.func_205109_c();
|
||||
@@ -830,7 +835,7 @@
|
||||
this.field_147595_R = true;
|
||||
BlockPos blockpos2 = chunkrenderdispatcher$chunkrender4.func_178568_j().func_177982_a(8, 8, 8);
|
||||
boolean flag1 = blockpos2.func_177951_i(blockpos) < 768.0D;
|
||||
@@ -9,7 +21,7 @@
|
||||
this.field_175009_l.add(chunkrenderdispatcher$chunkrender4);
|
||||
} else {
|
||||
this.field_72777_q.func_213239_aq().func_76320_a("build near");
|
||||
@@ -915,13 +915,13 @@
|
||||
@@ -915,13 +920,13 @@
|
||||
float f = p_228426_7_.func_205001_m();
|
||||
boolean flag1 = this.field_72777_q.field_71441_e.func_239132_a_().func_230493_a_(MathHelper.func_76128_c(d0), MathHelper.func_76128_c(d1)) || this.field_72777_q.field_71456_v.func_184046_j().func_184056_f();
|
||||
if (this.field_72777_q.field_71474_y.field_151451_c >= 4) {
|
||||
@@ -25,7 +37,7 @@
|
||||
iprofiler.func_219895_b("terrain_setup");
|
||||
this.func_228437_a_(p_228426_6_, clippinghelper, flag, this.field_228409_ai_++, this.field_72777_q.field_71439_g.func_175149_v());
|
||||
iprofiler.func_219895_b("updatechunks");
|
||||
@@ -942,7 +942,9 @@
|
||||
@@ -942,7 +947,9 @@
|
||||
this.func_174967_a(p_228426_3_ + l1);
|
||||
iprofiler.func_219895_b("terrain");
|
||||
this.func_228441_a_(RenderType.func_228639_c_(), p_228426_1_, d0, d1, d2);
|
||||
@@ -35,7 +47,7 @@
|
||||
this.func_228441_a_(RenderType.func_228643_e_(), p_228426_1_, d0, d1, d2);
|
||||
if (this.field_72769_h.func_239132_a_().func_239217_c_()) {
|
||||
RenderHelper.func_237533_a_(p_228426_1_.func_227866_c_().func_227870_a_());
|
||||
@@ -1010,6 +1012,7 @@
|
||||
@@ -1010,6 +1017,7 @@
|
||||
List<TileEntity> list = worldrenderer$localrenderinformationcontainer.field_178036_a.func_178571_g().func_178485_b();
|
||||
if (!list.isEmpty()) {
|
||||
for(TileEntity tileentity1 : list) {
|
||||
@@ -43,7 +55,7 @@
|
||||
BlockPos blockpos3 = tileentity1.func_174877_v();
|
||||
IRenderTypeBuffer irendertypebuffer1 = irendertypebuffer$impl;
|
||||
p_228426_1_.func_227860_a_();
|
||||
@@ -1035,6 +1038,7 @@
|
||||
@@ -1035,6 +1043,7 @@
|
||||
|
||||
synchronized(this.field_181024_n) {
|
||||
for(TileEntity tileentity : this.field_181024_n) {
|
||||
@@ -51,7 +63,7 @@
|
||||
BlockPos blockpos2 = tileentity.func_174877_v();
|
||||
p_228426_1_.func_227860_a_();
|
||||
p_228426_1_.func_227861_a_((double)blockpos2.func_177958_n() - d0, (double)blockpos2.func_177956_o() - d1, (double)blockpos2.func_177952_p() - d2);
|
||||
@@ -1084,10 +1088,13 @@
|
||||
@@ -1084,10 +1093,13 @@
|
||||
iprofiler.func_219895_b("outline");
|
||||
BlockPos blockpos = ((BlockRayTraceResult)raytraceresult).func_216350_a();
|
||||
BlockState blockstate = this.field_72769_h.func_180495_p(blockpos);
|
||||
@@ -66,7 +78,7 @@
|
||||
}
|
||||
|
||||
RenderSystem.pushMatrix();
|
||||
@@ -1119,7 +1126,7 @@
|
||||
@@ -1119,7 +1131,7 @@
|
||||
this.field_239224_H_.func_237506_a_(this.field_72777_q.func_147110_a());
|
||||
RenderState.field_239237_T_.func_228547_a_();
|
||||
iprofiler.func_219895_b("particles");
|
||||
@@ -75,7 +87,7 @@
|
||||
RenderState.field_239237_T_.func_228549_b_();
|
||||
} else {
|
||||
iprofiler.func_219895_b("translucent");
|
||||
@@ -1129,7 +1136,7 @@
|
||||
@@ -1129,7 +1141,7 @@
|
||||
iprofiler.func_219895_b("string");
|
||||
this.func_228441_a_(RenderType.func_241715_r_(), p_228426_1_, d0, d1, d2);
|
||||
iprofiler.func_219895_b("particles");
|
||||
@@ -84,7 +96,40 @@
|
||||
}
|
||||
|
||||
RenderSystem.pushMatrix();
|
||||
@@ -2076,7 +2083,12 @@
|
||||
@@ -1481,6 +1493,11 @@
|
||||
}
|
||||
|
||||
public void func_228424_a_(MatrixStack p_228424_1_, float p_228424_2_) {
|
||||
+ net.minecraftforge.client.ISkyRenderHandler renderHandler = field_72769_h.func_239132_a_().getSkyRenderHandler();
|
||||
+ if (renderHandler != null) {
|
||||
+ renderHandler.render(field_72773_u, p_228424_2_, p_228424_1_, field_72769_h, field_72777_q);
|
||||
+ return;
|
||||
+ }
|
||||
if (this.field_72777_q.field_71441_e.func_239132_a_().func_241683_c_() == DimensionRenderInfo.FogType.END) {
|
||||
this.func_228444_b_(p_228424_1_);
|
||||
} else if (this.field_72777_q.field_71441_e.func_239132_a_().func_241683_c_() == DimensionRenderInfo.FogType.NORMAL) {
|
||||
@@ -1609,6 +1626,11 @@
|
||||
}
|
||||
|
||||
public void func_228425_a_(MatrixStack p_228425_1_, float p_228425_2_, double p_228425_3_, double p_228425_5_, double p_228425_7_) {
|
||||
+ net.minecraftforge.client.ICloudRenderHandler renderHandler = field_72769_h.func_239132_a_().getCloudRenderHandler();
|
||||
+ if (renderHandler != null) {
|
||||
+ renderHandler.render(field_72773_u, p_228425_2_, p_228425_1_, field_72769_h, field_72777_q, p_228425_3_, p_228425_5_, p_228425_7_);
|
||||
+ return;
|
||||
+ }
|
||||
float f = this.field_72769_h.func_239132_a_().func_239213_a_();
|
||||
if (!Float.isNaN(f)) {
|
||||
RenderSystem.disableCull();
|
||||
@@ -1792,7 +1814,7 @@
|
||||
|
||||
while(iterator.hasNext()) {
|
||||
ChunkRenderDispatcher.ChunkRender chunkrenderdispatcher$chunkrender = iterator.next();
|
||||
- if (chunkrenderdispatcher$chunkrender.func_188281_o()) {
|
||||
+ if (!net.minecraftforge.common.ForgeConfig.CLIENT.alwaysSetupTerrainOffThread.get() && chunkrenderdispatcher$chunkrender.func_188281_o()) {
|
||||
this.field_174995_M.func_228902_a_(chunkrenderdispatcher$chunkrender);
|
||||
} else {
|
||||
chunkrenderdispatcher$chunkrender.func_228929_a_(this.field_174995_M);
|
||||
@@ -2076,7 +2098,12 @@
|
||||
this.field_175008_n.func_217628_a(p_215319_1_, p_215319_2_, p_215319_3_, p_215319_4_);
|
||||
}
|
||||
|
||||
@@ -97,7 +142,7 @@
|
||||
ISound isound = this.field_147593_P.get(p_184377_2_);
|
||||
if (isound != null) {
|
||||
this.field_72777_q.func_147118_V().func_147683_b(isound);
|
||||
@@ -2084,7 +2096,7 @@
|
||||
@@ -2084,7 +2111,7 @@
|
||||
}
|
||||
|
||||
if (p_184377_1_ != null) {
|
||||
@@ -106,7 +151,7 @@
|
||||
if (musicdiscitem != null) {
|
||||
this.field_72777_q.field_71456_v.func_238451_a_(musicdiscitem.func_234801_g_());
|
||||
}
|
||||
@@ -2232,7 +2244,7 @@
|
||||
@@ -2232,7 +2259,7 @@
|
||||
break;
|
||||
case 1010:
|
||||
if (Item.func_150899_d(p_180439_4_) instanceof MusicDiscItem) {
|
||||
@@ -115,7 +160,7 @@
|
||||
} else {
|
||||
this.func_184377_a((SoundEvent)null, p_180439_3_);
|
||||
}
|
||||
@@ -2382,8 +2394,8 @@
|
||||
@@ -2382,8 +2409,8 @@
|
||||
break;
|
||||
case 2001:
|
||||
BlockState blockstate = Block.func_196257_b(p_180439_4_);
|
||||
@@ -126,7 +171,7 @@
|
||||
this.field_72769_h.func_184156_a(p_180439_3_, soundtype.func_185845_c(), SoundCategory.BLOCKS, (soundtype.func_185843_a() + 1.0F) / 2.0F, soundtype.func_185847_b() * 0.8F, false);
|
||||
}
|
||||
|
||||
@@ -2531,7 +2543,7 @@
|
||||
@@ -2531,7 +2558,7 @@
|
||||
} else {
|
||||
int i = p_228420_0_.func_226658_a_(LightType.SKY, p_228420_2_);
|
||||
int j = p_228420_0_.func_226658_a_(LightType.BLOCK, p_228420_2_);
|
||||
@@ -135,7 +180,7 @@
|
||||
if (j < k) {
|
||||
j = k;
|
||||
}
|
||||
@@ -2570,6 +2582,11 @@
|
||||
@@ -2570,6 +2597,11 @@
|
||||
return this.field_239226_J_;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
private final ItemCameraTransforms field_177651_f;
|
||||
|
||||
+ public Builder(net.minecraftforge.client.model.IModelConfiguration model, ItemOverrideList overrides) {
|
||||
+ this(model.useSmoothLighting(), model.isShadedInGui(), model.isSideLit(), model.getCameraTransforms(), overrides);
|
||||
+ this(model.useSmoothLighting(), model.isSideLit(), model.isShadedInGui(), model.getCameraTransforms(), overrides);
|
||||
+ }
|
||||
+
|
||||
public Builder(BlockModel p_i230060_1_, ItemOverrideList p_i230060_2_, boolean p_i230060_3_) {
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
|
||||
public boolean func_151470_d() {
|
||||
- return this.field_74513_e;
|
||||
+ return this.field_74513_e && getKeyConflictContext().isActive() && getKeyModifier().isActive(getKeyConflictContext());
|
||||
+ return this.field_74513_e && isConflictContextAndModifierActive();
|
||||
}
|
||||
|
||||
public String func_151466_e() {
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
--- a/net/minecraft/client/settings/ToggleableKeyBinding.java
|
||||
+++ b/net/minecraft/client/settings/ToggleableKeyBinding.java
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
public void func_225593_a_(boolean p_225593_1_) {
|
||||
if (this.field_228053_a_.getAsBoolean()) {
|
||||
- if (p_225593_1_) {
|
||||
+ if (p_225593_1_ && isConflictContextAndModifierActive()) {
|
||||
super.func_225593_a_(!this.func_151470_d());
|
||||
}
|
||||
} else {
|
||||
@@ -24,4 +24,5 @@
|
||||
}
|
||||
|
||||
}
|
||||
+ @Override public boolean func_151470_d() { return this.field_74513_e; }
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
--- a/net/minecraft/client/world/DimensionRenderInfo.java
|
||||
+++ b/net/minecraft/client/world/DimensionRenderInfo.java
|
||||
@@ -26,6 +26,9 @@
|
||||
private final DimensionRenderInfo.FogType field_241680_e_;
|
||||
private final boolean field_241681_f_;
|
||||
private final boolean field_239212_e_;
|
||||
+ private net.minecraftforge.client.IWeatherRenderHandler weatherRenderHandler = null;
|
||||
+ private net.minecraftforge.client.ISkyRenderHandler skyRenderHandler = null;
|
||||
+ private net.minecraftforge.client.ICloudRenderHandler cloudRenderHandler = null;
|
||||
|
||||
public DimensionRenderInfo(float p_i241259_1_, boolean p_i241259_2_, DimensionRenderInfo.FogType p_i241259_3_, boolean p_i241259_4_, boolean p_i241259_5_) {
|
||||
this.field_239210_c_ = p_i241259_1_;
|
||||
@@ -82,6 +85,28 @@
|
||||
return this.field_239212_e_;
|
||||
}
|
||||
|
||||
+ public void setWeatherRenderHandler(net.minecraftforge.client.IWeatherRenderHandler weatherRenderHandler) {
|
||||
+ this.weatherRenderHandler = weatherRenderHandler;
|
||||
+ }
|
||||
+ public void setSkyRenderHandler(net.minecraftforge.client.ISkyRenderHandler skyRenderHandler) {
|
||||
+ this.skyRenderHandler = skyRenderHandler;
|
||||
+ }
|
||||
+ public void setCloudRenderHandler(net.minecraftforge.client.ICloudRenderHandler cloudRenderHandler) {
|
||||
+ this.cloudRenderHandler = cloudRenderHandler;
|
||||
+ }
|
||||
+ @Nullable
|
||||
+ public net.minecraftforge.client.ICloudRenderHandler getCloudRenderHandler() {
|
||||
+ return cloudRenderHandler;
|
||||
+ }
|
||||
+ @Nullable
|
||||
+ public net.minecraftforge.client.IWeatherRenderHandler getWeatherRenderHandler() {
|
||||
+ return weatherRenderHandler;
|
||||
+ }
|
||||
+ @Nullable
|
||||
+ public net.minecraftforge.client.ISkyRenderHandler getSkyRenderHandler() {
|
||||
+ return skyRenderHandler;
|
||||
+ }
|
||||
+
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static class End extends DimensionRenderInfo {
|
||||
public End() {
|
||||
@@ -8,10 +8,11 @@
|
||||
|
||||
this.field_197062_b.findAmbiguities((p_201302_1_, p_201302_2_, p_201302_3_, p_201302_4_) -> {
|
||||
field_197061_a.warn("Ambiguity between arguments {} and {} with inputs: {}", this.field_197062_b.getPath(p_201302_2_), this.field_197062_b.getPath(p_201302_3_), p_201302_4_);
|
||||
@@ -205,6 +206,14 @@
|
||||
@@ -205,7 +206,15 @@
|
||||
|
||||
try {
|
||||
try {
|
||||
- return this.field_197062_b.execute(stringreader, p_197059_1_);
|
||||
+ ParseResults<CommandSource> parse = this.field_197062_b.parse(stringreader, p_197059_1_);
|
||||
+ net.minecraftforge.event.CommandEvent event = new net.minecraftforge.event.CommandEvent(parse);
|
||||
+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) {
|
||||
@@ -20,6 +21,7 @@
|
||||
+ }
|
||||
+ return 1;
|
||||
+ }
|
||||
return this.field_197062_b.execute(stringreader, p_197059_1_);
|
||||
+ return this.field_197062_b.execute(event.getParseResults());
|
||||
} catch (CommandException commandexception) {
|
||||
p_197059_1_.func_197021_a(commandexception.func_197003_a());
|
||||
return 0;
|
||||
@@ -35,7 +35,7 @@
|
||||
p_77659_2_.func_71029_a(Stats.field_75929_E.func_199076_b(this));
|
||||
- p_77659_2_.func_184185_a(fluid.func_207185_a(FluidTags.field_206960_b) ? SoundEvents.field_187633_N : SoundEvents.field_187630_M, 1.0F, 1.0F);
|
||||
+
|
||||
+ SoundEvent soundevent = this.field_77876_a.getAttributes().getEmptySound();
|
||||
+ SoundEvent soundevent = this.field_77876_a.getAttributes().getFillSound();
|
||||
+ if (soundevent == null) soundevent = fluid.func_207185_a(FluidTags.field_206960_b) ? SoundEvents.field_187633_N : SoundEvents.field_187630_M;
|
||||
+ p_77659_2_.func_184185_a(soundevent, 1.0F, 1.0F);
|
||||
ItemStack itemstack1 = DrinkHelper.func_242398_a(itemstack, p_77659_2_, new ItemStack(fluid.func_204524_b()));
|
||||
|
||||
@@ -8,3 +8,11 @@
|
||||
}
|
||||
|
||||
public FunctionReloader func_240960_a_() {
|
||||
@@ -81,6 +82,7 @@
|
||||
|
||||
public void func_240971_i_() {
|
||||
this.field_240955_e_.func_242231_a().func_242212_e();
|
||||
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.TagsUpdatedEvent.CustomTagTypes(field_240955_e_.func_242231_a()));
|
||||
}
|
||||
|
||||
public void close() {
|
||||
@@ -1,11 +1,15 @@
|
||||
--- a/net/minecraft/tags/BlockTags.java
|
||||
+++ b/net/minecraft/tags/BlockTags.java
|
||||
@@ -97,6 +97,10 @@
|
||||
@@ -97,6 +97,14 @@
|
||||
return field_199899_c.func_232937_a_(p_199894_0_);
|
||||
}
|
||||
|
||||
+ public static net.minecraftforge.common.Tags.IOptionalNamedTag<Block> createOptional(ResourceLocation name) {
|
||||
+ return field_199899_c.createOptional(name, () -> null);
|
||||
+ return createOptional(name, null);
|
||||
+ }
|
||||
+
|
||||
+ public static net.minecraftforge.common.Tags.IOptionalNamedTag<Block> createOptional(ResourceLocation name, @javax.annotation.Nullable java.util.Set<java.util.function.Supplier<Block>> defaults) {
|
||||
+ return field_199899_c.createOptional(name, defaults);
|
||||
+ }
|
||||
+
|
||||
public static ITagCollection<Block> func_199896_a() {
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
--- a/net/minecraft/tags/EntityTypeTags.java
|
||||
+++ b/net/minecraft/tags/EntityTypeTags.java
|
||||
@@ -16,6 +16,10 @@
|
||||
@@ -16,6 +16,14 @@
|
||||
return field_219766_c.func_232937_a_(p_232896_0_);
|
||||
}
|
||||
|
||||
+ public static net.minecraftforge.common.Tags.IOptionalNamedTag<EntityType<?>> createOptional(ResourceLocation name) {
|
||||
+ return field_219766_c.createOptional(name, () -> null);
|
||||
+ return createOptional(name, null);
|
||||
+ }
|
||||
+
|
||||
+ public static net.minecraftforge.common.Tags.IOptionalNamedTag<EntityType<?>> createOptional(ResourceLocation name, @javax.annotation.Nullable java.util.Set<java.util.function.Supplier<EntityType<?>>> defaults) {
|
||||
+ return field_219766_c.createOptional(name, defaults);
|
||||
+ }
|
||||
+
|
||||
public static ITagCollection<EntityType<?>> func_219762_a() {
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
--- a/net/minecraft/tags/FluidTags.java
|
||||
+++ b/net/minecraft/tags/FluidTags.java
|
||||
@@ -13,7 +13,16 @@
|
||||
@@ -13,7 +13,20 @@
|
||||
return field_206961_c.func_232937_a_(p_206956_0_);
|
||||
}
|
||||
|
||||
+ public static net.minecraftforge.common.Tags.IOptionalNamedTag<Fluid> createOptional(ResourceLocation name) {
|
||||
+ return field_206961_c.createOptional(name, () -> null);
|
||||
+ return createOptional(name, null);
|
||||
+ }
|
||||
+
|
||||
+ public static net.minecraftforge.common.Tags.IOptionalNamedTag<Fluid> createOptional(ResourceLocation name, @javax.annotation.Nullable java.util.Set<java.util.function.Supplier<Fluid>> defaults) {
|
||||
+ return field_206961_c.createOptional(name, defaults);
|
||||
+ }
|
||||
+
|
||||
public static List<? extends ITag.INamedTag<Fluid>> func_241280_c_() {
|
||||
|
||||
@@ -17,3 +17,36 @@
|
||||
}
|
||||
|
||||
default void func_242210_a(PacketBuffer p_242210_1_) {
|
||||
@@ -58,4 +59,32 @@
|
||||
}
|
||||
};
|
||||
}
|
||||
+
|
||||
+ static ITagCollectionSupplier reinjectOptionalTags(ITagCollectionSupplier tagCollectionSupplier) {
|
||||
+ ITagCollection<Block> blockTagCollection = BlockTags.field_199899_c.reinjectOptionalTags(tagCollectionSupplier.func_241835_a());
|
||||
+ ITagCollection<Item> itemTagCollection = ItemTags.field_199906_c.reinjectOptionalTags(tagCollectionSupplier.func_241836_b());
|
||||
+ ITagCollection<Fluid> fluidTagCollection = FluidTags.field_206961_c.reinjectOptionalTags(tagCollectionSupplier.func_241837_c());
|
||||
+ ITagCollection<EntityType<?>> entityTypeTagCollection = EntityTypeTags.field_219766_c.reinjectOptionalTags(tagCollectionSupplier.func_241838_d());
|
||||
+ return new ITagCollectionSupplier() {
|
||||
+ @Override
|
||||
+ public ITagCollection<Block> func_241835_a() {
|
||||
+ return blockTagCollection;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public ITagCollection<Item> func_241836_b() {
|
||||
+ return itemTagCollection;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public ITagCollection<Fluid> func_241837_c() {
|
||||
+ return fluidTagCollection;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public ITagCollection<EntityType<?>> func_241838_d() {
|
||||
+ return entityTypeTagCollection;
|
||||
+ }
|
||||
+ };
|
||||
+ }
|
||||
}
|
||||
@@ -1,11 +1,15 @@
|
||||
--- a/net/minecraft/tags/ItemTags.java
|
||||
+++ b/net/minecraft/tags/ItemTags.java
|
||||
@@ -65,6 +65,10 @@
|
||||
@@ -65,6 +65,14 @@
|
||||
return field_199906_c.func_232937_a_(p_199901_0_);
|
||||
}
|
||||
|
||||
+ public static net.minecraftforge.common.Tags.IOptionalNamedTag<Item> createOptional(ResourceLocation name) {
|
||||
+ return field_199906_c.createOptional(name, () -> null);
|
||||
+ return createOptional(name, null);
|
||||
+ }
|
||||
+
|
||||
+ public static net.minecraftforge.common.Tags.IOptionalNamedTag<Item> createOptional(ResourceLocation name, @javax.annotation.Nullable java.util.Set<java.util.function.Supplier<Item>> defaults) {
|
||||
+ return field_199906_c.createOptional(name, defaults);
|
||||
+ }
|
||||
+
|
||||
public static ITagCollection<Item> func_199903_a() {
|
||||
|
||||
@@ -23,3 +23,12 @@
|
||||
ITagCollectionSupplier itagcollectionsupplier = ITagCollectionSupplier.func_242209_a(itagcollection, itagcollection1, itagcollection2, itagcollection3);
|
||||
Multimap<ResourceLocation, ResourceLocation> multimap = TagRegistryManager.func_242198_b(itagcollectionsupplier);
|
||||
if (!multimap.isEmpty()) {
|
||||
@@ -43,6 +46,8 @@
|
||||
return p_232978_0_.getKey() + ":" + p_232978_0_.getValue();
|
||||
}).sorted().collect(Collectors.joining(",")));
|
||||
} else {
|
||||
+ itagcollectionsupplier = ITagCollectionSupplier.reinjectOptionalTags(itagcollectionsupplier);
|
||||
+ net.minecraftforge.common.ForgeTagHandler.reinjectOptionalTagsCustomTypes();
|
||||
TagCollectionManager.func_242180_a(itagcollectionsupplier);
|
||||
this.field_242230_e = itagcollectionsupplier;
|
||||
}
|
||||
@@ -15,7 +15,7 @@
|
||||
+ return add(new TagRegistry.NamedTag<>(new ResourceLocation(p_232937_1_)));
|
||||
+ }
|
||||
+
|
||||
+ public net.minecraftforge.common.Tags.IOptionalNamedTag<T> createOptional(ResourceLocation key, @Nullable java.util.function.Supplier<Set<T>> defaults) {
|
||||
+ public net.minecraftforge.common.Tags.IOptionalNamedTag<T> createOptional(ResourceLocation key, @Nullable Set<java.util.function.Supplier<T>> defaults) {
|
||||
+ return add(new TagRegistry.OptionalNamedTag<>(key, defaults));
|
||||
+ }
|
||||
+
|
||||
@@ -24,8 +24,8 @@
|
||||
+ return delayedAdd(tagRegistry, new TagRegistry.NamedTag<>(name));
|
||||
+ }
|
||||
+
|
||||
+ /** Call via ForgeTagHandler#createOptionalTag to avoid any exceptions due to calling this after it is safe to call {@link #createOptional(ResourceLocation, java.util.function.Supplier)} */
|
||||
+ public static <T> net.minecraftforge.common.Tags.IOptionalNamedTag<T> createDelayedOptional(ResourceLocation tagRegistry, ResourceLocation key, @Nullable java.util.function.Supplier<Set<T>> defaults) {
|
||||
+ /** Call via ForgeTagHandler#createOptionalTag to avoid any exceptions due to calling this after it is safe to call {@link #createOptional(ResourceLocation, Set)} */
|
||||
+ public static <T> net.minecraftforge.common.Tags.IOptionalNamedTag<T> createDelayedOptional(ResourceLocation tagRegistry, ResourceLocation key, @Nullable Set<java.util.function.Supplier<T>> defaults) {
|
||||
+ return delayedAdd(tagRegistry, new TagRegistry.OptionalNamedTag<>(key, defaults));
|
||||
+ }
|
||||
+
|
||||
@@ -53,7 +53,28 @@
|
||||
this.field_232931_c_.add(namedtag);
|
||||
return namedtag;
|
||||
}
|
||||
@@ -56,7 +94,7 @@
|
||||
@@ -46,6 +84,20 @@
|
||||
});
|
||||
}
|
||||
|
||||
+ public ITagCollection<T> reinjectOptionalTags(ITagCollection<T> tagCollection) {
|
||||
+ java.util.Map<ResourceLocation, ITag<T>> currentTags = tagCollection.func_241833_a();
|
||||
+ java.util.Map<ResourceLocation, ITag<T>> missingOptionals = this.field_232931_c_.stream().filter(e -> e instanceof OptionalNamedTag && !currentTags.containsKey(e.func_230234_a_())).collect(Collectors.toMap(NamedTag::func_230234_a_, namedTag -> {
|
||||
+ OptionalNamedTag<T> optionalNamedTag = (OptionalNamedTag<T>) namedTag;
|
||||
+ optionalNamedTag.defaulted = true;
|
||||
+ return optionalNamedTag.resolveDefaulted();
|
||||
+ }));
|
||||
+ if (!missingOptionals.isEmpty()) {
|
||||
+ missingOptionals.putAll(currentTags);
|
||||
+ return ITagCollection.func_242202_a(missingOptionals);
|
||||
+ }
|
||||
+ return tagCollection;
|
||||
+ }
|
||||
+
|
||||
public ITagCollection<T> func_232939_b_() {
|
||||
return this.field_232930_b_;
|
||||
}
|
||||
@@ -56,7 +108,7 @@
|
||||
|
||||
public Set<ResourceLocation> func_242189_b(ITagCollectionSupplier p_242189_1_) {
|
||||
ITagCollection<T> itagcollection = this.field_242184_c.apply(p_242189_1_);
|
||||
@@ -62,7 +83,7 @@
|
||||
ImmutableSet<ResourceLocation> immutableset = ImmutableSet.copyOf(itagcollection.func_199908_a());
|
||||
return Sets.difference(set, immutableset);
|
||||
}
|
||||
@@ -93,5 +131,45 @@
|
||||
@@ -93,5 +145,40 @@
|
||||
public List<T> func_230236_b_() {
|
||||
return this.func_232944_c_().func_230236_b_();
|
||||
}
|
||||
@@ -77,10 +98,10 @@
|
||||
+
|
||||
+ private static class OptionalNamedTag<T> extends NamedTag<T> implements net.minecraftforge.common.Tags.IOptionalNamedTag<T> {
|
||||
+ @Nullable
|
||||
+ private final java.util.function.Supplier<Set<T>> defaults;
|
||||
+ private boolean defaulted = true;
|
||||
+ private final Set<java.util.function.Supplier<T>> defaults;
|
||||
+ private boolean defaulted = false;
|
||||
+
|
||||
+ private OptionalNamedTag(ResourceLocation name, @Nullable java.util.function.Supplier<Set<T>> defaults) {
|
||||
+ private OptionalNamedTag(ResourceLocation name, @Nullable Set<java.util.function.Supplier<T>> defaults) {
|
||||
+ super(name);
|
||||
+ this.defaults = defaults;
|
||||
+ }
|
||||
@@ -90,16 +111,11 @@
|
||||
+ return defaulted;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ void func_232943_a_(Function<ResourceLocation, ITag<T>> p_232943_1_) {
|
||||
+ super.func_232943_a_(p_232943_1_);
|
||||
+ if (this.field_232942_b_ == null) {
|
||||
+ this.defaulted = true;
|
||||
+ Set<T> defs = defaults == null ? null : defaults.get();
|
||||
+ this.field_232942_b_ = defs == null ? Tag.func_241284_a_() : Tag.func_241286_a_(defs);
|
||||
+ } else {
|
||||
+ this.defaulted = false;
|
||||
+ Tag<T> resolveDefaulted() {
|
||||
+ if (defaults == null || defaults.isEmpty()) {
|
||||
+ return Tag.func_241284_a_();
|
||||
+ }
|
||||
+ return Tag.func_241286_a_(ImmutableSet.copyOf(defaults.stream().map(java.util.function.Supplier::get).collect(Collectors.toSet())));
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
if (itemstack.func_190926_b()) {
|
||||
return false;
|
||||
} else if (!PotionBrewing.func_185205_a(itemstack)) {
|
||||
@@ -163,16 +164,16 @@
|
||||
@@ -163,22 +164,22 @@
|
||||
}
|
||||
|
||||
private void func_145940_l() {
|
||||
@@ -18,18 +18,26 @@
|
||||
- for(int i = 0; i < 3; ++i) {
|
||||
- this.field_145945_j.set(i, PotionBrewing.func_185212_d(itemstack, this.field_145945_j.get(i)));
|
||||
- }
|
||||
-
|
||||
- itemstack.func_190918_g(1);
|
||||
+ net.minecraftforge.common.brewing.BrewingRecipeRegistry.brewPotions(field_145945_j, itemstack, field_145947_i);
|
||||
|
||||
itemstack.func_190918_g(1);
|
||||
+ net.minecraftforge.event.ForgeEventFactory.onPotionBrewed(field_145945_j);
|
||||
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();
|
||||
+ itemstack.func_190918_g(1);
|
||||
if (itemstack.func_190926_b()) {
|
||||
itemstack = itemstack1;
|
||||
} else if (!this.field_145850_b.field_72995_K) {
|
||||
InventoryHelper.func_180173_a(this.field_145850_b, (double)blockpos.func_177958_n(), (double)blockpos.func_177956_o(), (double)blockpos.func_177952_p(), itemstack1);
|
||||
}
|
||||
}
|
||||
+ else itemstack.func_190918_g(1);
|
||||
|
||||
this.field_145945_j.set(3, itemstack);
|
||||
this.field_145850_b.func_217379_c(1035, blockpos, 0);
|
||||
@@ -229,13 +230,13 @@
|
||||
|
||||
public boolean func_94041_b(int p_94041_1_, ItemStack p_94041_2_) {
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
--- a/net/minecraft/util/registry/WorldSettingsImport.java
|
||||
+++ b/net/minecraft/util/registry/WorldSettingsImport.java
|
||||
@@ -190,6 +190,7 @@
|
||||
) {
|
||||
JsonParser jsonparser = new JsonParser();
|
||||
JsonElement jsonelement = jsonparser.parse(reader);
|
||||
+ if (jsonelement!= null) jsonelement.getAsJsonObject().addProperty("forge:registry_name", p_241879_3_.func_240901_a_().toString());
|
||||
return p_241879_4_.parse(p_241879_1_, jsonelement).map((p_244347_0_) -> {
|
||||
return Pair.of(p_244347_0_, OptionalInt.empty());
|
||||
});
|
||||
@@ -231,6 +232,7 @@
|
||||
|
||||
public <E> DataResult<Pair<E, OptionalInt>> func_241879_a(DynamicOps<JsonElement> p_241879_1_, RegistryKey<? extends Registry<E>> p_241879_2_, RegistryKey<E> p_241879_3_, Decoder<E> p_241879_4_) {
|
||||
JsonElement jsonelement = this.field_244349_a.get(p_241879_3_);
|
||||
+ if (jsonelement!= null) jsonelement.getAsJsonObject().addProperty("forge:registry_name", p_241879_3_.func_240901_a_().toString());
|
||||
return jsonelement == null ? DataResult.error("Unknown element: " + p_241879_3_) : p_241879_4_.parse(p_241879_1_, jsonelement).setLifecycle(this.field_244351_c.get(p_241879_3_)).map((p_244353_2_) -> {
|
||||
return Pair.of(p_244353_2_, OptionalInt.of(this.field_244350_b.getInt(p_241879_3_)));
|
||||
});
|
||||
@@ -9,7 +9,18 @@
|
||||
public static final Logger field_150586_aC = LogManager.getLogger();
|
||||
public static final Codec<Biome> field_242418_b = RecordCodecBuilder.create((p_235064_0_) -> {
|
||||
return p_235064_0_.group(Biome.Climate.field_242459_a.forGetter((p_242446_0_) -> {
|
||||
@@ -200,7 +200,7 @@
|
||||
@@ -70,7 +70,9 @@
|
||||
return p_242443_0_.field_242424_k;
|
||||
}), MobSpawnInfo.field_242552_c.forGetter((p_242442_0_) -> {
|
||||
return p_242442_0_.field_242425_l;
|
||||
- })).apply(p_235064_0_, Biome::new);
|
||||
+ }), ResourceLocation.field_240908_a_.fieldOf("forge:registry_name").forGetter(Biome::getRegistryName))
|
||||
+ .apply(p_235064_0_, (climate, category, depth, scale, effects, gen, spawns, name) ->
|
||||
+ net.minecraftforge.common.ForgeHooks.enhanceBiome(name, climate, category, depth, scale, effects, gen, spawns, p_235064_0_, Biome::new));
|
||||
});
|
||||
public static final Codec<Biome> field_242419_c = RecordCodecBuilder.create((p_242432_0_) -> {
|
||||
return p_242432_0_.group(Biome.Climate.field_242459_a.forGetter((p_242441_0_) -> {
|
||||
@@ -200,7 +202,7 @@
|
||||
} else {
|
||||
if (p_201850_2_.func_177956_o() >= 0 && p_201850_2_.func_177956_o() < 256 && p_201850_1_.func_226658_a_(LightType.BLOCK, p_201850_2_) < 10) {
|
||||
BlockState blockstate = p_201850_1_.func_180495_p(p_201850_2_);
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
--- a/net/minecraft/world/biome/BiomeGenerationSettings.java
|
||||
+++ b/net/minecraft/world/biome/BiomeGenerationSettings.java
|
||||
@@ -47,6 +47,7 @@
|
||||
});
|
||||
private final Supplier<ConfiguredSurfaceBuilder<?>> field_242482_d;
|
||||
private final Map<GenerationStage.Carving, List<Supplier<ConfiguredCarver<?>>>> field_242483_e;
|
||||
+ private final java.util.Set<GenerationStage.Carving> carversView;
|
||||
private final List<List<Supplier<ConfiguredFeature<?, ?>>>> field_242484_f;
|
||||
private final List<Supplier<StructureFeature<?, ?>>> field_242485_g;
|
||||
private final List<ConfiguredFeature<?, ?>> field_242486_h;
|
||||
@@ -59,12 +60,17 @@
|
||||
this.field_242486_h = p_i241935_3_.stream().flatMap(Collection::stream).map(Supplier::get).flatMap(ConfiguredFeature::func_242768_d).filter((p_242490_0_) -> {
|
||||
return p_242490_0_.field_222737_a == Feature.field_227247_y_;
|
||||
}).collect(ImmutableList.toImmutableList());
|
||||
+ this.carversView = java.util.Collections.unmodifiableSet(field_242483_e.keySet());
|
||||
}
|
||||
|
||||
public List<Supplier<ConfiguredCarver<?>>> func_242489_a(GenerationStage.Carving p_242489_1_) {
|
||||
return this.field_242483_e.getOrDefault(p_242489_1_, ImmutableList.of());
|
||||
}
|
||||
|
||||
+ public java.util.Set<GenerationStage.Carving> getCarvingStages() {
|
||||
+ return this.carversView;
|
||||
+ }
|
||||
+
|
||||
public boolean func_242493_a(Structure<?> p_242493_1_) {
|
||||
return this.field_242485_g.stream().anyMatch((p_242494_1_) -> {
|
||||
return (p_242494_1_.get()).field_236268_b_ == p_242493_1_;
|
||||
@@ -0,0 +1,38 @@
|
||||
--- a/net/minecraft/world/biome/MobSpawnInfo.java
|
||||
+++ b/net/minecraft/world/biome/MobSpawnInfo.java
|
||||
@@ -42,23 +42,35 @@
|
||||
private final Map<EntityClassification, List<MobSpawnInfo.Spawners>> field_242554_e;
|
||||
private final Map<EntityType<?>, MobSpawnInfo.SpawnCosts> field_242555_f;
|
||||
private final boolean field_242556_g;
|
||||
+ private final java.util.Set<EntityClassification> typesView;
|
||||
+ private final java.util.Set<EntityType<?>> costView;
|
||||
|
||||
private MobSpawnInfo(float p_i241946_1_, Map<EntityClassification, List<MobSpawnInfo.Spawners>> p_i241946_2_, Map<EntityType<?>, MobSpawnInfo.SpawnCosts> p_i241946_3_, boolean p_i241946_4_) {
|
||||
this.field_242553_d = p_i241946_1_;
|
||||
this.field_242554_e = p_i241946_2_;
|
||||
this.field_242555_f = p_i241946_3_;
|
||||
this.field_242556_g = p_i241946_4_;
|
||||
+ this.typesView = java.util.Collections.unmodifiableSet(this.field_242554_e.keySet());
|
||||
+ this.costView = java.util.Collections.unmodifiableSet(this.field_242555_f.keySet());
|
||||
}
|
||||
|
||||
public List<MobSpawnInfo.Spawners> func_242559_a(EntityClassification p_242559_1_) {
|
||||
return this.field_242554_e.getOrDefault(p_242559_1_, ImmutableList.of());
|
||||
}
|
||||
|
||||
+ public java.util.Set<EntityClassification> getSpawnerTypes() {
|
||||
+ return this.typesView;
|
||||
+ }
|
||||
+
|
||||
@Nullable
|
||||
public MobSpawnInfo.SpawnCosts func_242558_a(EntityType<?> p_242558_1_) {
|
||||
return this.field_242555_f.get(p_242558_1_);
|
||||
}
|
||||
|
||||
+ public java.util.Set<EntityType<?>> getEntityTypes() {
|
||||
+ return this.costView;
|
||||
+ }
|
||||
+
|
||||
public float func_242557_a() {
|
||||
return this.field_242553_d;
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
--- a/net/minecraft/world/gen/layer/BiomeLayer.java
|
||||
+++ b/net/minecraft/world/gen/layer/BiomeLayer.java
|
||||
@@ -10,12 +10,13 @@
|
||||
private static final int[] field_202746_t = new int[]{4, 3, 5, 1};
|
||||
private static final int[] field_202747_u = new int[]{12, 12, 12, 30};
|
||||
private int[] field_151623_c = field_202744_r;
|
||||
+ private final boolean legacyDesert;
|
||||
+ private java.util.List<net.minecraftforge.common.BiomeManager.BiomeEntry>[] biomes = new java.util.ArrayList[net.minecraftforge.common.BiomeManager.BiomeType.values().length];
|
||||
|
||||
public BiomeLayer(boolean p_i232147_1_) {
|
||||
- if (p_i232147_1_) {
|
||||
- this.field_151623_c = field_202743_q;
|
||||
- }
|
||||
-
|
||||
+ this.legacyDesert = p_i232147_1_;
|
||||
+ for (net.minecraftforge.common.BiomeManager.BiomeType type : net.minecraftforge.common.BiomeManager.BiomeType.values())
|
||||
+ biomes[type.ordinal()] = new java.util.ArrayList<>(net.minecraftforge.common.BiomeManager.getBiomes(type));
|
||||
}
|
||||
|
||||
public int func_202726_a(INoiseRandom p_202726_1_, int p_202726_2_) {
|
||||
@@ -28,21 +29,21 @@
|
||||
return p_202726_1_.func_202696_a(3) == 0 ? 39 : 38;
|
||||
}
|
||||
|
||||
- return this.field_151623_c[p_202726_1_.func_202696_a(this.field_151623_c.length)];
|
||||
+ return getBiomeId(net.minecraftforge.common.BiomeManager.BiomeType.DESERT, p_202726_1_);
|
||||
case 2:
|
||||
if (i > 0) {
|
||||
return 21;
|
||||
}
|
||||
|
||||
- return field_202745_s[p_202726_1_.func_202696_a(field_202745_s.length)];
|
||||
+ return getBiomeId(net.minecraftforge.common.BiomeManager.BiomeType.WARM, p_202726_1_);
|
||||
case 3:
|
||||
if (i > 0) {
|
||||
return 32;
|
||||
}
|
||||
|
||||
- return field_202746_t[p_202726_1_.func_202696_a(field_202746_t.length)];
|
||||
+ return getBiomeId(net.minecraftforge.common.BiomeManager.BiomeType.COOL, p_202726_1_);
|
||||
case 4:
|
||||
- return field_202747_u[p_202726_1_.func_202696_a(field_202747_u.length)];
|
||||
+ return getBiomeId(net.minecraftforge.common.BiomeManager.BiomeType.ICY, p_202726_1_);
|
||||
default:
|
||||
return 14;
|
||||
}
|
||||
@@ -50,4 +51,17 @@
|
||||
return p_202726_2_;
|
||||
}
|
||||
}
|
||||
+
|
||||
+ private int getBiomeId(net.minecraftforge.common.BiomeManager.BiomeType type, INoiseRandom context) {
|
||||
+ return net.minecraft.util.registry.WorldGenRegistries.field_243657_i.func_148757_b(
|
||||
+ net.minecraft.util.registry.WorldGenRegistries.field_243657_i.func_230516_a_(getBiome(type, context)));
|
||||
+ }
|
||||
+ protected net.minecraft.util.RegistryKey<net.minecraft.world.biome.Biome> getBiome(net.minecraftforge.common.BiomeManager.BiomeType type, INoiseRandom context) {
|
||||
+ if (type == net.minecraftforge.common.BiomeManager.BiomeType.DESERT && this.legacyDesert)
|
||||
+ type = net.minecraftforge.common.BiomeManager.BiomeType.DESERT_LEGACY;
|
||||
+ java.util.List<net.minecraftforge.common.BiomeManager.BiomeEntry> biomeList = biomes[type.ordinal()];
|
||||
+ int totalWeight = net.minecraft.util.WeightedRandom.func_76272_a(biomeList);
|
||||
+ int weight = net.minecraftforge.common.BiomeManager.isTypeListModded(type) ? context.func_202696_a(totalWeight) : context.func_202696_a(totalWeight / 10) * 10;
|
||||
+ return net.minecraft.util.WeightedRandom.func_180166_a(biomeList, weight).getKey();
|
||||
+ }
|
||||
}
|
||||
@@ -19,6 +19,8 @@
|
||||
|
||||
package net.minecraftforge.fml.loading;
|
||||
|
||||
import net.minecraftforge.forgespi.language.IModInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -29,10 +31,17 @@ public class EarlyLoadingException extends RuntimeException {
|
||||
public static class ExceptionData {
|
||||
|
||||
|
||||
private final IModInfo modInfo;
|
||||
private final String i18message;
|
||||
private final Object[] args;
|
||||
|
||||
public ExceptionData(final String message, Object... args) {
|
||||
this(message, null, args);
|
||||
}
|
||||
|
||||
public ExceptionData(final String message, final IModInfo modInfo, Object... args) {
|
||||
this.i18message = message;
|
||||
this.modInfo = modInfo;
|
||||
this.args = args;
|
||||
}
|
||||
|
||||
@@ -43,6 +52,10 @@ public class EarlyLoadingException extends RuntimeException {
|
||||
public Object[] getArgs() {
|
||||
return args;
|
||||
}
|
||||
|
||||
public IModInfo getModInfo() {
|
||||
return modInfo;
|
||||
}
|
||||
}
|
||||
private final List<ExceptionData> errorMessages;
|
||||
|
||||
|
||||
@@ -42,6 +42,7 @@ import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.function.Function;
|
||||
@@ -191,7 +192,7 @@ public class ModSorter
|
||||
if (!dupedMods.isEmpty()) {
|
||||
final List<EarlyLoadingException.ExceptionData> duplicateModErrors = dupedMods
|
||||
.stream()
|
||||
.map(dm -> new EarlyLoadingException.ExceptionData("fml.modloading.dupedmod", dm.getValue().get(0)))
|
||||
.map(dm -> new EarlyLoadingException.ExceptionData("fml.modloading.dupedmod", dm.getValue().get(0), Objects.toString(dm.getValue().get(0))))
|
||||
.collect(Collectors.toList());
|
||||
throw new EarlyLoadingException("Duplicate mods found", null, duplicateModErrors);
|
||||
}
|
||||
@@ -243,7 +244,7 @@ public class ModSorter
|
||||
if (!missingVersions.isEmpty()) {
|
||||
final List<EarlyLoadingException.ExceptionData> exceptionData = missingVersions
|
||||
.stream()
|
||||
.map(mv -> new EarlyLoadingException.ExceptionData("fml.modloading.missingdependency",
|
||||
.map(mv -> new EarlyLoadingException.ExceptionData("fml.modloading.missingdependency", mv.getOwner(),
|
||||
mv.getModId(), mv.getOwner().getModId(), mv.getVersionRange(),
|
||||
modVersions.getOrDefault(mv.getModId(), new DefaultArtifactVersion("null"))))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
package net.minecraftforge.fml.loading.moddiscovery;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import net.minecraftforge.fml.loading.StringUtils;
|
||||
import net.minecraftforge.forgespi.language.IConfigurable;
|
||||
import net.minecraftforge.forgespi.language.IModFileInfo;
|
||||
@@ -65,7 +66,7 @@ public class ModFileInfo implements IModFileInfo, IConfigurable
|
||||
.map(MavenVersionAdapter::createFromVersionSpec)
|
||||
.orElseThrow(()->new InvalidModFileException("Missing ModLoader version in file", this));
|
||||
this.license = config.<String>getConfigElement("license")
|
||||
.orElseThrow(()->new InvalidModFileException("Missing License, please supply a license.", this));
|
||||
.orElse("");
|
||||
this.showAsResourcePack = config.<Boolean>getConfigElement("showAsResourcePack").orElse(false);
|
||||
this.properties = config.<Map<String, Object>>getConfigElement("properties").orElse(Collections.emptyMap());
|
||||
this.modFile.setFileProperties(this.properties);
|
||||
@@ -147,4 +148,9 @@ public class ModFileInfo implements IModFileInfo, IConfigurable
|
||||
{
|
||||
return issueURL;
|
||||
}
|
||||
|
||||
public boolean missingLicense()
|
||||
{
|
||||
return Strings.isNullOrEmpty(license);
|
||||
}
|
||||
}
|
||||
@@ -67,7 +67,6 @@ a012d6d92bab1c91913bd0f2dc0492a0fce916f2 assets/minecraft/blockstates/wall_torch
|
||||
d2c8e860521c5e738ed0798337f5728d610825ff assets/piston_event_test/models/block/shiftonmove.json
|
||||
f51f026a75e27a0a53a76771d553c0e3385a2966 assets/piston_event_test/models/item/shiftonmove.json
|
||||
cf16f861eaf5815238c2278eb48bde0688cb73b7 assets/scaffolding_test/blockstates/scaffolding_method_test.json
|
||||
42d3ce7d941eb8b80c3d541b937d0f93c9cf7c3c data/custom_tag_types_test/tags/biomes/oceans.json
|
||||
862196702dcd5538c5ceb4ac6202e57eb5c8a97f data/custom_tag_types_test/tags/custom_tag_types_test/custom_types/tests.json
|
||||
4fbaf6f4a3ea05cc071076e27f44ac81f9cc50e3 data/data_gen_test/advancements/conditional.json
|
||||
ed4cbf1a3a2f5d8969f6346fdc9acdbe81d0c919 data/data_gen_test/recipes/conditional.json
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"minecraft:ocean",
|
||||
"minecraft:frozen_ocean",
|
||||
"minecraft:deep_ocean",
|
||||
"minecraft:warm_ocean",
|
||||
"minecraft:lukewarm_ocean",
|
||||
"minecraft:cold_ocean",
|
||||
"minecraft:deep_warm_ocean",
|
||||
"minecraft:deep_lukewarm_ocean",
|
||||
"minecraft:deep_cold_ocean",
|
||||
"minecraft:deep_frozen_ocean"
|
||||
]
|
||||
}
|
||||
@@ -24,12 +24,14 @@ import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.world.ClientWorld;
|
||||
|
||||
/**
|
||||
* Call {@link net.minecraft.world.dimension.Dimension#setCloudRenderer} with an implementation of this
|
||||
* to override all cloud rendering with your own.
|
||||
* Use {@link ICloudRenderHandler} instead.
|
||||
*
|
||||
* todo: remove in 1.17
|
||||
*/
|
||||
@Deprecated
|
||||
public interface CloudRenderHandler extends IRenderHandler {
|
||||
@Override
|
||||
default void render(int ticks, float partialTicks, ClientWorld world, Minecraft mc) {}
|
||||
|
||||
void render(int ticks, float partialTicks, MatrixStack matrixStack, ClientWorld world, Minecraft mc);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2020.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation version 2.1
|
||||
* of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
package net.minecraftforge.client;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.world.ClientWorld;
|
||||
|
||||
/**
|
||||
* Call {@link net.minecraft.client.world.DimensionRenderInfo#setCloudRenderHandler(ICloudRenderHandler)}, obtained from a {@link ClientWorld} with an implementation of this to override all cloud rendering with your own.
|
||||
* This is only responsible for rendering clouds.
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface ICloudRenderHandler {
|
||||
void render(int ticks, float partialTicks, MatrixStack matrixStack, ClientWorld world, Minecraft mc, double viewEntityX, double viewEntityY, double viewEntityZ);
|
||||
}
|
||||
@@ -24,9 +24,15 @@ import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.world.ClientWorld;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
/**
|
||||
* Use one of {@link IWeatherRenderHandler}, {@link ICloudRenderHandler} or {@link ISkyRenderHandler} instead.
|
||||
*
|
||||
* todo: remove in 1.17
|
||||
*/
|
||||
@Deprecated
|
||||
@FunctionalInterface
|
||||
public interface IRenderHandler
|
||||
{
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
void render(int ticks, float partialTicks, ClientWorld world, Minecraft mc);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2020.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation version 2.1
|
||||
* of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
package net.minecraftforge.client;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.world.ClientWorld;
|
||||
|
||||
/**
|
||||
* Call {@link net.minecraft.client.world.DimensionRenderInfo#setSkyRenderHandler(ISkyRenderHandler)}, obtained from a {@link ClientWorld} with an implementation of this to override all sky rendering with your own.
|
||||
* This includes the sun, moon, stars, and sky-coloring.
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface ISkyRenderHandler {
|
||||
void render(int ticks, float partialTicks, MatrixStack matrixStack, ClientWorld world, Minecraft mc);
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2020.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation version 2.1
|
||||
* of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
package net.minecraftforge.client;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.LightTexture;
|
||||
import net.minecraft.client.world.ClientWorld;
|
||||
|
||||
/**
|
||||
* Call {@link net.minecraft.client.world.DimensionRenderInfo#setWeatherRenderHandler(IWeatherRenderHandler)}, obtained from a {@link ClientWorld} with an implementation of this to override all weather rendering with your own.
|
||||
* This includes rain and snow.
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface IWeatherRenderHandler {
|
||||
void render(int ticks, float partialTicks, ClientWorld world, Minecraft mc, LightTexture lightmapIn, double xIn, double yIn, double zIn);
|
||||
}
|
||||
@@ -23,10 +23,12 @@ import java.io.IOException;
|
||||
import java.util.BitSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
@@ -97,16 +99,16 @@ public class MinecraftForgeClient
|
||||
}
|
||||
}
|
||||
|
||||
private static final LoadingCache<Pair<World, BlockPos>, ChunkRenderCache> regionCache = CacheBuilder.newBuilder()
|
||||
private static final LoadingCache<Pair<World, BlockPos>, Optional<ChunkRenderCache>> regionCache = CacheBuilder.newBuilder()
|
||||
.maximumSize(500)
|
||||
.concurrencyLevel(5)
|
||||
.expireAfterAccess(1, TimeUnit.SECONDS)
|
||||
.build(new CacheLoader<Pair<World, BlockPos>, ChunkRenderCache>()
|
||||
.build(new CacheLoader<Pair<World, BlockPos>, Optional<ChunkRenderCache>>()
|
||||
{
|
||||
@Override
|
||||
public ChunkRenderCache load(Pair<World, BlockPos> key)
|
||||
public Optional<ChunkRenderCache> load(Pair<World, BlockPos> key)
|
||||
{
|
||||
return ChunkRenderCache.generateCache(key.getLeft(), key.getRight().add(-1, -1, -1), key.getRight().add(16, 16, 16), 1);
|
||||
return Optional.ofNullable(ChunkRenderCache.generateCache(key.getLeft(), key.getRight().add(-1, -1, -1), key.getRight().add(16, 16, 16), 1));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -115,10 +117,16 @@ public class MinecraftForgeClient
|
||||
if (cache == null)
|
||||
regionCache.invalidate(Pair.of(world, position));
|
||||
else
|
||||
regionCache.put(Pair.of(world, position), cache);
|
||||
regionCache.put(Pair.of(world, position), Optional.of(cache));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static ChunkRenderCache getRegionRenderCache(World world, BlockPos pos)
|
||||
{
|
||||
return getRegionRenderCacheOptional(world, pos).orElse(null);
|
||||
}
|
||||
|
||||
public static Optional<ChunkRenderCache> getRegionRenderCacheOptional(World world, BlockPos pos)
|
||||
{
|
||||
int x = pos.getX() & ~0xF;
|
||||
int y = pos.getY() & ~0xF;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
|
||||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2020.
|
||||
@@ -24,13 +25,15 @@ import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.world.ClientWorld;
|
||||
|
||||
/**
|
||||
* Call {@link net.minecraft.world.dimension.Dimension#setSkyRenderer} with an implementation of this
|
||||
* to override all sky rendering with your own. This includes the sun, moon, stars, and sky-coloring.
|
||||
* Use {@link ISkyRenderHandler} instead.
|
||||
*
|
||||
* todo: remove in 1.17
|
||||
*/
|
||||
@Deprecated
|
||||
public interface SkyRenderHandler extends IRenderHandler {
|
||||
@Override
|
||||
default void render(int ticks, float partialTicks, ClientWorld world, Minecraft mc) {}
|
||||
|
||||
void render(int ticks, float partialTicks, MatrixStack matrixStack, ClientWorld world, Minecraft mc);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -20,8 +20,10 @@
|
||||
package net.minecraftforge.client;
|
||||
|
||||
/**
|
||||
* Call {@link net.minecraft.world.dimension.Dimension#setWeatherRenderer} with an implementation of this
|
||||
* to override all weather rendering with your own. This includes rain and snow.
|
||||
* Use {@link IWeatherRenderHandler} instead.
|
||||
*
|
||||
* todo: remove in 1.17
|
||||
*/
|
||||
@Deprecated
|
||||
public interface WeatherRenderHandler extends IRenderHandler {
|
||||
}
|
||||
}
|
||||
@@ -55,6 +55,11 @@ public interface IForgeKeybinding
|
||||
|
||||
void setKeyModifierAndCode(KeyModifier keyModifier, InputMappings.Input keyCode);
|
||||
|
||||
default boolean isConflictContextAndModifierActive()
|
||||
{
|
||||
return getKeyConflictContext().isActive() && getKeyModifier().isActive(getKeyConflictContext());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true when one of the bindings' key codes conflicts with the other's modifier.
|
||||
*/
|
||||
|
||||
@@ -214,7 +214,7 @@ public class CompositeModel implements IDynamicBakedModel
|
||||
continue;
|
||||
bakedParts.put(part.getKey(), submodel.bakeModel(bakery, spriteGetter, modelTransform, modelLocation));
|
||||
}
|
||||
return new CompositeModel(owner.isShadedInGui(), owner.useSmoothLighting(), owner.isSideLit(), particle, bakedParts.build(), owner.getCombinedTransform(), overrides);
|
||||
return new CompositeModel(owner.isShadedInGui(), owner.isSideLit(), owner.useSmoothLighting(), particle, bakedParts.build(), owner.getCombinedTransform(), overrides);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -58,7 +58,10 @@ public interface IModelConfiguration {
|
||||
RenderMaterial resolveTexture(String name);
|
||||
|
||||
/**
|
||||
* @return True if the item uses 3D lighting.
|
||||
* @return True if the item is a 3D model, false if it's a generated item model.
|
||||
* TODO: Rename.
|
||||
* This value has nothing to do with shading anymore, and this name is misleading.
|
||||
* It's actual purpose seems to be relegated to translating the model during rendering, so that it's centered.
|
||||
*/
|
||||
boolean isShadedInGui();
|
||||
|
||||
|
||||
+2
-1
@@ -66,7 +66,8 @@ public class TileEntityRendererAnimation<T extends TileEntity> extends TileEntit
|
||||
}
|
||||
if(blockRenderer == null) blockRenderer = Minecraft.getInstance().getBlockRendererDispatcher();
|
||||
BlockPos pos = te.getPos();
|
||||
IBlockDisplayReader world = MinecraftForgeClient.getRegionRenderCache(te.getWorld(), pos);
|
||||
IBlockDisplayReader world = MinecraftForgeClient.getRegionRenderCacheOptional(te.getWorld(), pos)
|
||||
.map(IBlockDisplayReader.class::cast).orElseGet(() -> te.getWorld());
|
||||
BlockState state = world.getBlockState(pos);
|
||||
IBakedModel model = blockRenderer.getBlockModelShapes().getModel(state);
|
||||
IModelData data = model.getModelData(world, pos, state, ModelDataManager.getModelData(te.getWorld(), pos));
|
||||
|
||||
@@ -51,8 +51,6 @@ public class BlockInfo
|
||||
|
||||
private boolean full;
|
||||
|
||||
private float shx = 0, shy = 0, shz = 0;
|
||||
|
||||
private int cachedTint = -1;
|
||||
private int cachedMultiplier = -1;
|
||||
|
||||
@@ -69,12 +67,9 @@ public class BlockInfo
|
||||
return cachedMultiplier;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void updateShift()
|
||||
{
|
||||
Vector3d offset = state.getOffset(world, blockPos);
|
||||
shx = (float) offset.x;
|
||||
shy = (float) offset.y;
|
||||
shz = (float) offset.z;
|
||||
}
|
||||
|
||||
public void setWorld(IBlockDisplayReader world)
|
||||
@@ -96,7 +91,6 @@ public class BlockInfo
|
||||
this.blockPos = blockPos;
|
||||
cachedTint = -1;
|
||||
cachedMultiplier = -1;
|
||||
shx = shy = shz = 0;
|
||||
}
|
||||
|
||||
public void reset()
|
||||
@@ -106,7 +100,6 @@ public class BlockInfo
|
||||
this.blockPos = null;
|
||||
cachedTint = -1;
|
||||
cachedMultiplier = -1;
|
||||
shx = shy = shz = 0;
|
||||
}
|
||||
|
||||
private float combine(int c, int s1, int s2, int s3, boolean t0, boolean t1, boolean t2, boolean t3)
|
||||
@@ -251,19 +244,22 @@ public class BlockInfo
|
||||
return full;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public float getShx()
|
||||
{
|
||||
return shx;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public float getShy()
|
||||
{
|
||||
return shy;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public float getShz()
|
||||
{
|
||||
return shz;
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int getCachedTint()
|
||||
|
||||
@@ -190,10 +190,6 @@ public class VertexLighterFlat extends QuadGatheringTransformer
|
||||
|
||||
for(int v = 0; v < 4; v++)
|
||||
{
|
||||
position[v][0] += blockInfo.getShx();
|
||||
position[v][1] += blockInfo.getShy();
|
||||
position[v][2] += blockInfo.getShz();
|
||||
|
||||
float x = position[v][0] - .5f;
|
||||
float y = position[v][1] - .5f;
|
||||
float z = position[v][2] - .5f;
|
||||
@@ -335,7 +331,6 @@ public class VertexLighterFlat extends QuadGatheringTransformer
|
||||
|
||||
public void updateBlockInfo()
|
||||
{
|
||||
blockInfo.updateShift();
|
||||
blockInfo.updateFlatLighting();
|
||||
}
|
||||
}
|
||||
@@ -17,71 +17,69 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/* Biomes are completely redone in 1.16.2, reevaluate
|
||||
package net.minecraftforge.common;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
import net.minecraft.world.biome.Biomes;
|
||||
import net.minecraft.util.RegistryKey;
|
||||
import net.minecraft.util.WeightedRandom;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.biome.provider.BiomeProvider;
|
||||
import net.minecraft.world.gen.INoiseRandom;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class BiomeManager
|
||||
{
|
||||
private static TrackedList<BiomeEntry>[] biomes = setupBiomes();
|
||||
|
||||
public static List<Biome> oceanBiomes = new ArrayList<Biome>();
|
||||
|
||||
static
|
||||
{
|
||||
oceanBiomes.add(Biomes.OCEAN);
|
||||
oceanBiomes.add(Biomes.DEEP_OCEAN);
|
||||
oceanBiomes.add(Biomes.FROZEN_OCEAN);
|
||||
}
|
||||
|
||||
private static TrackedList<BiomeEntry>[] setupBiomes()
|
||||
{
|
||||
@SuppressWarnings("unchecked")
|
||||
TrackedList<BiomeEntry>[] currentBiomes = new TrackedList[BiomeType.values().length];
|
||||
List<BiomeEntry> list = new ArrayList<BiomeEntry>();
|
||||
|
||||
list.add(new BiomeEntry(Biomes.FOREST, 10));
|
||||
list.add(new BiomeEntry(Biomes.DARK_FOREST, 10));
|
||||
list.add(new BiomeEntry(Biomes.MOUNTAINS, 10));
|
||||
list.add(new BiomeEntry(Biomes.PLAINS, 10));
|
||||
list.add(new BiomeEntry(Biomes.BIRCH_FOREST, 10));
|
||||
list.add(new BiomeEntry(Biomes.SWAMP, 10));
|
||||
currentBiomes[BiomeType.DESERT_LEGACY.ordinal()] = new TrackedList<>(
|
||||
new BiomeEntry(Biomes.DESERT, 10),
|
||||
new BiomeEntry(Biomes.FOREST, 10),
|
||||
new BiomeEntry(Biomes.MOUNTAINS, 10),
|
||||
new BiomeEntry(Biomes.SWAMP, 10),
|
||||
new BiomeEntry(Biomes.PLAINS, 10),
|
||||
new BiomeEntry(Biomes.TAIGA, 10)
|
||||
);
|
||||
|
||||
currentBiomes[BiomeType.WARM.ordinal()] = new TrackedList<BiomeEntry>(list);
|
||||
list.clear();
|
||||
currentBiomes[BiomeType.DESERT.ordinal()] = new TrackedList<>(
|
||||
new BiomeEntry(Biomes.DESERT, 30),
|
||||
new BiomeEntry(Biomes.SAVANNA, 20),
|
||||
new BiomeEntry(Biomes.PLAINS, 10)
|
||||
);
|
||||
|
||||
list.add(new BiomeEntry(Biomes.FOREST, 10));
|
||||
list.add(new BiomeEntry(Biomes.MOUNTAINS, 10));
|
||||
list.add(new BiomeEntry(Biomes.TAIGA, 10));
|
||||
list.add(new BiomeEntry(Biomes.PLAINS, 10));
|
||||
currentBiomes[BiomeType.WARM.ordinal()] = new TrackedList<>(
|
||||
new BiomeEntry(Biomes.FOREST, 10),
|
||||
new BiomeEntry(Biomes.DARK_FOREST, 10),
|
||||
new BiomeEntry(Biomes.MOUNTAINS, 10),
|
||||
new BiomeEntry(Biomes.PLAINS, 10),
|
||||
new BiomeEntry(Biomes.BIRCH_FOREST, 10),
|
||||
new BiomeEntry(Biomes.SWAMP, 10)
|
||||
);
|
||||
|
||||
currentBiomes[BiomeType.COOL.ordinal()] = new TrackedList<BiomeEntry>(list);
|
||||
list.clear();
|
||||
currentBiomes[BiomeType.COOL.ordinal()] = new TrackedList<>(
|
||||
new BiomeEntry(Biomes.FOREST, 10),
|
||||
new BiomeEntry(Biomes.MOUNTAINS, 10),
|
||||
new BiomeEntry(Biomes.TAIGA, 10),
|
||||
new BiomeEntry(Biomes.PLAINS, 10)
|
||||
);
|
||||
|
||||
list.add(new BiomeEntry(Biomes.SNOWY_TUNDRA, 30));
|
||||
list.add(new BiomeEntry(Biomes.SNOWY_TAIGA, 10));
|
||||
|
||||
currentBiomes[BiomeType.ICY.ordinal()] = new TrackedList<BiomeEntry>(list);
|
||||
list.clear();
|
||||
|
||||
currentBiomes[BiomeType.DESERT.ordinal()] = new TrackedList<BiomeEntry>(list);
|
||||
currentBiomes[BiomeType.ICY.ordinal()] = new TrackedList<>(
|
||||
new BiomeEntry(Biomes.SNOWY_TUNDRA, 30),
|
||||
new BiomeEntry(Biomes.SNOWY_TAIGA, 10)
|
||||
);
|
||||
|
||||
return currentBiomes;
|
||||
}
|
||||
|
||||
/*
|
||||
public static void addSpawnBiome(Biome biome)
|
||||
{
|
||||
if (!BiomeProvider.BIOMES_TO_SPAWN_IN.contains(biome))
|
||||
@@ -97,62 +95,54 @@ public class BiomeManager
|
||||
BiomeProvider.BIOMES_TO_SPAWN_IN.remove(biome);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
public static void addBiome(BiomeType type, BiomeEntry entry)
|
||||
public static boolean addBiome(BiomeType type, BiomeEntry entry)
|
||||
{
|
||||
int idx = type.ordinal();
|
||||
List<BiomeEntry> list = idx > biomes.length ? null : biomes[idx];
|
||||
if (list != null) list.add(entry);
|
||||
return list == null ? false : list.add(entry);
|
||||
}
|
||||
|
||||
public static void removeBiome(BiomeType type, BiomeEntry entry)
|
||||
public static boolean removeBiome(BiomeType type, BiomeEntry entry)
|
||||
{
|
||||
int idx = type.ordinal();
|
||||
List<BiomeEntry> list = idx > biomes.length ? null : biomes[idx];
|
||||
|
||||
if (list != null && list.contains(entry))
|
||||
{
|
||||
list.remove(entry);
|
||||
}
|
||||
return list == null ? false : list.remove(entry);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static ImmutableList<BiomeEntry> getBiomes(BiomeType type)
|
||||
{
|
||||
int idx = type.ordinal();
|
||||
List<BiomeEntry> list = idx >= biomes.length ? null : biomes[idx];
|
||||
|
||||
return list != null ? ImmutableList.copyOf(list) : null;
|
||||
return list != null ? ImmutableList.copyOf(list) : ImmutableList.of();
|
||||
}
|
||||
|
||||
public static boolean isTypeListModded(BiomeType type)
|
||||
{
|
||||
int idx = type.ordinal();
|
||||
TrackedList<BiomeEntry> list = idx > biomes.length ? null : biomes[idx];
|
||||
|
||||
if (list != null) return list.isModded();
|
||||
|
||||
return false;
|
||||
return list == null ? false : list.isModded();
|
||||
}
|
||||
|
||||
public static enum BiomeType
|
||||
{
|
||||
DESERT, WARM, COOL, ICY;
|
||||
|
||||
public static BiomeType create(String name) {
|
||||
return null;
|
||||
}
|
||||
DESERT, DESERT_LEGACY, WARM, COOL, ICY;
|
||||
}
|
||||
|
||||
public static class BiomeEntry extends WeightedRandom.Item
|
||||
{
|
||||
public final Biome biome;
|
||||
private final RegistryKey<Biome> key;
|
||||
|
||||
public BiomeEntry(Biome biome, int weight)
|
||||
public BiomeEntry(RegistryKey<Biome> key, int weight)
|
||||
{
|
||||
super(weight);
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
this.biome = biome;
|
||||
public RegistryKey<Biome> getKey()
|
||||
{
|
||||
return this.key;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,9 +151,10 @@ public class BiomeManager
|
||||
private static final long serialVersionUID = 1L;
|
||||
private boolean isModded = false;
|
||||
|
||||
public TrackedList(Collection<? extends E> c)
|
||||
@SafeVarargs
|
||||
private <T extends E> TrackedList(T... c)
|
||||
{
|
||||
super(c);
|
||||
super(Arrays.asList(c));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -242,4 +233,3 @@ public class BiomeManager
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
@@ -39,6 +39,8 @@ import com.google.gson.Gson;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParseException;
|
||||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import net.minecraft.advancements.Advancement;
|
||||
@@ -91,6 +93,7 @@ import net.minecraft.util.text.*;
|
||||
import net.minecraft.world.spawner.AbstractSpawner;
|
||||
import net.minecraft.tileentity.FurnaceTileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.SoundEvents;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
@@ -104,9 +107,15 @@ import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.IWorld;
|
||||
import net.minecraft.world.IWorldReader;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.biome.BiomeAmbience;
|
||||
import net.minecraft.world.biome.BiomeGenerationSettings;
|
||||
import net.minecraft.world.biome.MobSpawnInfo;
|
||||
import net.minecraftforge.common.loot.IGlobalLootModifier;
|
||||
import net.minecraftforge.common.loot.LootModifierManager;
|
||||
import net.minecraftforge.common.util.BlockSnapshot;
|
||||
import net.minecraftforge.common.world.BiomeGenerationSettingsBuilder;
|
||||
import net.minecraftforge.common.world.MobSpawnInfoBuilder;
|
||||
import net.minecraftforge.event.AnvilUpdateEvent;
|
||||
import net.minecraftforge.event.DifficultyChangeEvent;
|
||||
import net.minecraftforge.event.ForgeEventFactory;
|
||||
@@ -130,6 +139,7 @@ import net.minecraftforge.event.entity.player.AttackEntityEvent;
|
||||
import net.minecraftforge.event.entity.player.CriticalHitEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||
import net.minecraftforge.event.world.BiomeLoadingEvent;
|
||||
import net.minecraftforge.event.world.BlockEvent;
|
||||
import net.minecraftforge.event.world.NoteBlockEvent;
|
||||
import net.minecraftforge.eventbus.api.Event.Result;
|
||||
@@ -829,16 +839,35 @@ public class ForgeHooks
|
||||
new ResourceLocation("block/water_flow"))
|
||||
.overlay(new ResourceLocation("block/water_overlay"))
|
||||
.translationKey("block.minecraft.water")
|
||||
.color(0xFF3F76E4).build(fluid);
|
||||
.color(0xFF3F76E4)
|
||||
.sound(SoundEvents.ITEM_BUCKET_FILL, SoundEvents.ITEM_BUCKET_EMPTY)
|
||||
.build(fluid);
|
||||
if (fluid instanceof LavaFluid)
|
||||
return net.minecraftforge.fluids.FluidAttributes.builder(
|
||||
new ResourceLocation("block/lava_still"),
|
||||
new ResourceLocation("block/lava_flow"))
|
||||
.translationKey("block.minecraft.lava")
|
||||
.luminosity(15).density(3000).viscosity(6000).temperature(1300).build(fluid);
|
||||
.luminosity(15).density(3000).viscosity(6000).temperature(1300)
|
||||
.sound(SoundEvents.ITEM_BUCKET_FILL_LAVA, SoundEvents.ITEM_BUCKET_EMPTY_LAVA)
|
||||
.build(fluid);
|
||||
throw new RuntimeException("Mod fluids must override createAttributes.");
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
public interface BiomeCallbackFunction
|
||||
{
|
||||
Biome apply(final Biome.Climate climate, final Biome.Category category, final Float depth, final Float scale, final BiomeAmbience effects, final BiomeGenerationSettings gen, final MobSpawnInfo spawns);
|
||||
}
|
||||
|
||||
public static Biome enhanceBiome(final ResourceLocation name, final Biome.Climate climate, final Biome.Category category, final Float depth, final Float scale, final BiomeAmbience effects, final BiomeGenerationSettings gen, final MobSpawnInfo spawns, final RecordCodecBuilder.Instance<Biome> codec, final BiomeCallbackFunction callback)
|
||||
{
|
||||
BiomeGenerationSettingsBuilder genBuilder = new BiomeGenerationSettingsBuilder(gen);
|
||||
MobSpawnInfoBuilder spawnBuilder = new MobSpawnInfoBuilder(spawns);
|
||||
BiomeLoadingEvent event = new BiomeLoadingEvent(name, climate, category, depth, scale, effects, genBuilder, spawnBuilder);
|
||||
MinecraftForge.EVENT_BUS.post(event);
|
||||
return callback.apply(event.getClimate(), event.getCategory(), event.getDepth(), event.getScale(), event.getEffects(), event.getGeneration().func_242508_a(), event.getSpawns().func_242577_b());
|
||||
}
|
||||
|
||||
private static class LootTableContext
|
||||
{
|
||||
public final ResourceLocation name;
|
||||
|
||||
@@ -25,6 +25,7 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
@@ -121,7 +122,7 @@ public class ForgeTagHandler
|
||||
* @param <T> Type of the registry
|
||||
* @return An optional tag
|
||||
*/
|
||||
public static <T extends IForgeRegistryEntry<T>> IOptionalNamedTag<T> createOptionalTag(IForgeRegistry<T> registry, ResourceLocation name, @Nullable Supplier<Set<T>> defaults)
|
||||
public static <T extends IForgeRegistryEntry<T>> IOptionalNamedTag<T> createOptionalTag(IForgeRegistry<T> registry, ResourceLocation name, @Nullable Set<Supplier<T>> defaults)
|
||||
{
|
||||
validateRegistrySupportsTags(registry);
|
||||
if (tagTypesSet)
|
||||
@@ -180,7 +181,7 @@ public class ForgeTagHandler
|
||||
* @implNote This method only errors instantly if tag types have already been set, otherwise the error is delayed until after registries finish initializing
|
||||
* and we can validate if the custom registry really does support custom tags.
|
||||
*/
|
||||
public static <T extends IForgeRegistryEntry<T>> IOptionalNamedTag<T> createOptionalTag(ResourceLocation registryName, ResourceLocation name, @Nullable Supplier<Set<T>> defaults)
|
||||
public static <T extends IForgeRegistryEntry<T>> IOptionalNamedTag<T> createOptionalTag(ResourceLocation registryName, ResourceLocation name, @Nullable Set<Supplier<T>> defaults)
|
||||
{
|
||||
if (tagTypesSet)
|
||||
{
|
||||
@@ -220,6 +221,10 @@ public class ForgeTagHandler
|
||||
if (tagTypesSet) throw new RuntimeException("Custom tag types have already been set, this method should only be called by forge, and after registries are initialized");
|
||||
tagTypesSet = true;
|
||||
customTagTypeNames = ImmutableSet.copyOf(customTagTypes);
|
||||
//Add the static references for custom tag types to the proper tag registries
|
||||
// Note: If this ends up being a hotspot due to lots of mods having lots of statically registered tags
|
||||
// that get loaded/registered before the new registry event is fired/processed everywhere then this
|
||||
// potentially should end up being moved into an async processor.
|
||||
TagRegistry.performDelayedAdd();
|
||||
}
|
||||
|
||||
@@ -248,7 +253,7 @@ public class ForgeTagHandler
|
||||
*
|
||||
* @apiNote Internal
|
||||
*/
|
||||
public static void resetCachedTagCollections()
|
||||
public static void resetCachedTagCollections(boolean makeEmpty, boolean withOptional)
|
||||
{
|
||||
ImmutableMap.Builder<ResourceLocation, ITagCollection<?>> builder = ImmutableMap.builder();
|
||||
for (ResourceLocation registryName : customTagTypeNames)
|
||||
@@ -256,7 +261,17 @@ public class ForgeTagHandler
|
||||
TagRegistry<?> tagRegistry = TagRegistryManager.get(registryName);
|
||||
if (tagRegistry != null)
|
||||
{
|
||||
builder.put(registryName, ITagCollection.func_242202_a(tagRegistry.func_241288_c_().stream().distinct().collect(Collectors.toMap(INamedTag::func_230234_a_, namedTag -> namedTag))));
|
||||
if (makeEmpty)
|
||||
{
|
||||
if (withOptional)
|
||||
builder.put(registryName, tagRegistry.reinjectOptionalTags(ITagCollection.func_242202_a(Collections.emptyMap())));
|
||||
else
|
||||
builder.put(registryName, ITagCollection.func_242202_a(Collections.emptyMap()));
|
||||
}
|
||||
else
|
||||
{
|
||||
builder.put(registryName, ITagCollection.func_242202_a(tagRegistry.func_241288_c_().stream().distinct().collect(Collectors.toMap(INamedTag::func_230234_a_, namedTag -> namedTag))));
|
||||
}
|
||||
}
|
||||
}
|
||||
customTagTypes = builder.build();
|
||||
@@ -270,7 +285,7 @@ public class ForgeTagHandler
|
||||
public static ITagCollectionSupplier populateTagCollectionManager(ITagCollection<Block> blockTags, ITagCollection<Item> itemTags, ITagCollection<Fluid> fluidTags, ITagCollection<EntityType<?>> entityTypeTags)
|
||||
{
|
||||
//Default the tag collections
|
||||
resetCachedTagCollections();
|
||||
resetCachedTagCollections(false, false);
|
||||
if (!customTagTypes.isEmpty())
|
||||
{
|
||||
LOGGER.debug("Populated the TagCollectionManager with {} extra types", customTagTypes.size());
|
||||
@@ -301,6 +316,7 @@ public class ForgeTagHandler
|
||||
public static void updateCustomTagTypes(SyncCustomTagTypes packet)
|
||||
{
|
||||
customTagTypes = packet.getCustomTagTypes();
|
||||
reinjectOptionalTagsCustomTypes();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -321,6 +337,84 @@ public class ForgeTagHandler
|
||||
return customResults;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add all the missing optional tags back into the custom tag types tag collections
|
||||
*
|
||||
* @apiNote Internal
|
||||
*/
|
||||
public static void reinjectOptionalTagsCustomTypes()
|
||||
{
|
||||
ImmutableMap.Builder<ResourceLocation, ITagCollection<?>> builder = ImmutableMap.builder();
|
||||
for (Entry<ResourceLocation, ITagCollection<?>> entry : customTagTypes.entrySet())
|
||||
{
|
||||
ResourceLocation registry = entry.getKey();
|
||||
TagRegistry<?> tagRegistry = TagRegistryManager.get(registry);
|
||||
ITagCollection<?> tagCollection = entry.getValue();
|
||||
builder.put(registry, tagRegistry == null ? tagCollection : tagRegistry.reinjectOptionalTags((ITagCollection) tagCollection));
|
||||
}
|
||||
customTagTypes = builder.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an {@link ITagCollectionSupplier} with empty custom tag type collections to allow for checking if the client is requiring any tags of custom tag types.
|
||||
*
|
||||
* @apiNote Internal: For use with validating missing tags when connecting to a vanilla server
|
||||
*/
|
||||
public static ITagCollectionSupplier withNoCustom(ITagCollectionSupplier tagCollectionSupplier)
|
||||
{
|
||||
ImmutableMap.Builder<ResourceLocation, ITagCollection<?>> builder = ImmutableMap.builder();
|
||||
for (ResourceLocation registryName : customTagTypeNames)
|
||||
{
|
||||
TagRegistry<?> tagRegistry = TagRegistryManager.get(registryName);
|
||||
if (tagRegistry != null)
|
||||
{
|
||||
builder.put(registryName, ITagCollection.func_242202_a(Collections.emptyMap()));
|
||||
}
|
||||
}
|
||||
return withSpecificCustom(tagCollectionSupplier, builder.build());
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an {@link ITagCollectionSupplier} with specific custom tag types for testing if any tags are missing.
|
||||
*
|
||||
* @apiNote Internal
|
||||
*/
|
||||
public static ITagCollectionSupplier withSpecificCustom(ITagCollectionSupplier tagCollectionSupplier, Map<ResourceLocation, ITagCollection<?>> customTagTypes)
|
||||
{
|
||||
return new ITagCollectionSupplier()
|
||||
{
|
||||
@Override
|
||||
public ITagCollection<Block> func_241835_a()
|
||||
{
|
||||
return tagCollectionSupplier.func_241835_a();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITagCollection<Item> func_241836_b()
|
||||
{
|
||||
return tagCollectionSupplier.func_241836_b();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITagCollection<Fluid> func_241837_c()
|
||||
{
|
||||
return tagCollectionSupplier.func_241837_c();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITagCollection<EntityType<?>> func_241838_d()
|
||||
{
|
||||
return tagCollectionSupplier.func_241838_d();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<ResourceLocation, ITagCollection<?>> getCustomTagTypes()
|
||||
{
|
||||
return customTagTypes;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper storage class for keeping track of various data for all custom tag types in the NetworkTagReader to make the code easier to read.
|
||||
*
|
||||
|
||||
@@ -70,4 +70,10 @@ public abstract class ForgeRegistryTagsProvider<T extends IForgeRegistryEntry<T>
|
||||
{
|
||||
return generator.getOutputFolder().resolve("data/" + id.getNamespace() + "/tags/" + folder + "/" + id.getPath() + ".json");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getTagFolder()
|
||||
{
|
||||
return folder;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2020.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation version 2.1
|
||||
* of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
package net.minecraftforge.common.world;
|
||||
|
||||
import net.minecraft.world.biome.BiomeGenerationSettings;
|
||||
import net.minecraft.world.gen.GenerationStage;
|
||||
import net.minecraft.world.gen.carver.ConfiguredCarver;
|
||||
import net.minecraft.world.gen.feature.ConfiguredFeature;
|
||||
import net.minecraft.world.gen.feature.StructureFeature;
|
||||
import net.minecraft.world.gen.surfacebuilders.ConfiguredSurfaceBuilder;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class BiomeGenerationSettingsBuilder extends BiomeGenerationSettings.Builder
|
||||
{
|
||||
public BiomeGenerationSettingsBuilder(BiomeGenerationSettings orig)
|
||||
{
|
||||
field_242504_a = Optional.of(orig.func_242500_d());
|
||||
orig.getCarvingStages().forEach(k -> field_242505_b.put(k, new ArrayList<>(orig.func_242489_a(k))));
|
||||
orig.func_242498_c().forEach(l -> field_242506_c.add(new ArrayList<>(l)));
|
||||
field_242507_d.addAll(orig.func_242487_a());
|
||||
}
|
||||
|
||||
public List<Supplier<ConfiguredFeature<?, ?>>> getFeatures(GenerationStage.Decoration stage) {
|
||||
func_242509_a(stage.ordinal());
|
||||
return field_242506_c.get(stage.ordinal());
|
||||
}
|
||||
|
||||
public Optional<Supplier<ConfiguredSurfaceBuilder<?>>> getSurfaceBuilder() {
|
||||
return field_242504_a;
|
||||
}
|
||||
|
||||
public List<Supplier<ConfiguredCarver<?>>> getCarvers(GenerationStage.Carving stage) {
|
||||
return field_242505_b.computeIfAbsent(stage, key -> new ArrayList<>());
|
||||
}
|
||||
|
||||
public List<Supplier<StructureFeature<?, ?>>> getStructures() {
|
||||
return field_242507_d;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2020.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation version 2.1
|
||||
* of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
package net.minecraftforge.common.world;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.entity.EntityClassification;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.world.biome.MobSpawnInfo;
|
||||
|
||||
public class MobSpawnInfoBuilder extends MobSpawnInfo.Builder
|
||||
{
|
||||
private final Set<EntityClassification> typesView = Collections.unmodifiableSet(this.field_242567_a.keySet());
|
||||
private final Set<EntityType<?>> costView = Collections.unmodifiableSet(this.field_242568_b.keySet());
|
||||
|
||||
public MobSpawnInfoBuilder(MobSpawnInfo orig)
|
||||
{
|
||||
orig.getSpawnerTypes().forEach(k -> {
|
||||
field_242567_a.get(k).clear();
|
||||
field_242567_a.get(k).addAll(new java.util.ArrayList<>(orig.func_242559_a(k)));
|
||||
});
|
||||
orig.getEntityTypes().forEach(k -> field_242568_b.put(k, orig.func_242558_a(k)));
|
||||
field_242569_c = orig.func_242557_a();
|
||||
field_242570_d = orig.func_242562_b();
|
||||
}
|
||||
|
||||
public Set<EntityClassification> getSpawnerTypes()
|
||||
{
|
||||
return this.typesView;
|
||||
}
|
||||
|
||||
public List<MobSpawnInfo.Spawners> getSpawner(EntityClassification type)
|
||||
{
|
||||
return this.field_242567_a.get(type);
|
||||
}
|
||||
|
||||
public Set<EntityType<?>> getEntityTypes()
|
||||
{
|
||||
return this.costView;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public MobSpawnInfo.SpawnCosts getCost(EntityType<?> type)
|
||||
{
|
||||
return this.field_242568_b.get(type);
|
||||
}
|
||||
|
||||
public float getProbability()
|
||||
{
|
||||
return this.field_242569_c;
|
||||
}
|
||||
|
||||
public MobSpawnInfoBuilder disablePlayerSpawn()
|
||||
{
|
||||
this.field_242570_d = false;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2020.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation version 2.1
|
||||
* of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
package net.minecraftforge.event.world;
|
||||
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.biome.BiomeAmbience;
|
||||
import net.minecraftforge.common.world.BiomeGenerationSettingsBuilder;
|
||||
import net.minecraftforge.common.world.MobSpawnInfoBuilder;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
import net.minecraftforge.eventbus.api.EventPriority;
|
||||
|
||||
/**
|
||||
* This event fires when a Biome is created from json or when a registered biome is re-created for worldgen.
|
||||
* It allows mods to edit a biome (like add a mob spawn) before it gets used for worldgen.
|
||||
*
|
||||
* In order to maintain the most compatibility possible with other mods' modifications to a biome,
|
||||
* the event should be assigned a {@link net.minecraftforge.eventbus.api.EventPriority} as follows:
|
||||
*
|
||||
* - Additions to any list/map contained in a biome : {@link EventPriority#HIGH}
|
||||
* - Removals to any list/map contained in a biome : {@link EventPriority#NORMAL}
|
||||
* - Any other modification : {@link EventPriority#LOW}
|
||||
*
|
||||
* Be aware that another mod could have done an operation beforehand, so an expected value out of a vanilla biome might not
|
||||
* always be the same, depending on other mods.
|
||||
*/
|
||||
public class BiomeLoadingEvent extends Event
|
||||
{
|
||||
private final ResourceLocation name;
|
||||
private Biome.Climate climate;
|
||||
private Biome.Category category;
|
||||
private float depth;
|
||||
private float scale;
|
||||
private BiomeAmbience effects;
|
||||
private final BiomeGenerationSettingsBuilder gen;
|
||||
private final MobSpawnInfoBuilder spawns;
|
||||
|
||||
public BiomeLoadingEvent(final ResourceLocation name, final Biome.Climate climate, final Biome.Category category, final float depth, final float scale, final BiomeAmbience effects, final BiomeGenerationSettingsBuilder gen, final MobSpawnInfoBuilder spawns)
|
||||
{
|
||||
this.name = name;
|
||||
this.climate = climate;
|
||||
this.category = category;
|
||||
this.depth = depth;
|
||||
this.scale = scale;
|
||||
this.effects = effects;
|
||||
this.gen = gen;
|
||||
this.spawns = spawns;
|
||||
}
|
||||
|
||||
public ResourceLocation getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
public Biome.Climate getClimate()
|
||||
{
|
||||
return climate;
|
||||
}
|
||||
|
||||
public void setClimate(final Biome.Climate value)
|
||||
{
|
||||
this.climate = value;
|
||||
}
|
||||
|
||||
public Biome.Category getCategory()
|
||||
{
|
||||
return category;
|
||||
}
|
||||
|
||||
public void setCategory(final Biome.Category value)
|
||||
{
|
||||
this.category = value;
|
||||
}
|
||||
|
||||
public float getDepth()
|
||||
{
|
||||
return depth;
|
||||
}
|
||||
|
||||
public void setDepth(final float value)
|
||||
{
|
||||
this.depth = value;
|
||||
}
|
||||
|
||||
public float getScale()
|
||||
{
|
||||
return scale;
|
||||
}
|
||||
|
||||
public void setScale(final float value)
|
||||
{
|
||||
this.scale = value;
|
||||
}
|
||||
|
||||
public BiomeAmbience getEffects()
|
||||
{
|
||||
return effects;
|
||||
}
|
||||
|
||||
public void setEffects(final BiomeAmbience value)
|
||||
{
|
||||
this.effects = value;
|
||||
}
|
||||
|
||||
public BiomeGenerationSettingsBuilder getGeneration()
|
||||
{
|
||||
return gen;
|
||||
}
|
||||
|
||||
public MobSpawnInfoBuilder getSpawns()
|
||||
{
|
||||
return spawns;
|
||||
}
|
||||
}
|
||||
@@ -120,6 +120,11 @@ public class ModLoader
|
||||
this.loadingWarnings = FMLLoader.getLoadingModList().
|
||||
getBrokenFiles().stream().map(file -> new ModLoadingWarning(null, ModLoadingStage.VALIDATE,
|
||||
InvalidModIdentifier.identifyJarProblem(file.getFilePath()).orElse("fml.modloading.brokenfile"), file.getFileName())).collect(Collectors.toList());
|
||||
FMLLoader.getLoadingModList()
|
||||
.getModFiles().stream().filter(ModFileInfo::missingLicense) //Search for files with missing licenses
|
||||
.filter(modFileInfo -> modFileInfo.getMods().stream().noneMatch(thisModInfo -> this.loadingExceptions.stream().map(ModLoadingException::getModInfo).anyMatch(otherInfo -> otherInfo == thisModInfo))) //Ignore files where any other mod already encountered an error
|
||||
.map(modFileInfo -> new ModLoadingException(null, ModLoadingStage.VALIDATE, "fml.modloading.missinglicense", null, modFileInfo.getFile()))
|
||||
.forEach(this.loadingExceptions::add);
|
||||
LOGGER.debug(CORE, "Loading Network data for FML net version: {}", FMLNetworkConstants.init());
|
||||
CrashReportExtender.registerCrashCallable("ModLauncher", FMLLoader::getLauncherInfo);
|
||||
CrashReportExtender.registerCrashCallable("ModLauncher launch target", FMLLoader::launcherHandlerName);
|
||||
@@ -190,10 +195,10 @@ public class ModLoader
|
||||
dispatchAndHandleError(ModLoadingStage.CREATE_REGISTRIES, syncExecutor, parallelExecutor, periodicTask);
|
||||
ObjectHolderRegistry.findObjectHolders();
|
||||
CapabilityManager.INSTANCE.injectCapabilities(modList.getAllScanData());
|
||||
statusConsumer.ifPresent(c->c.accept("Populating registries"));
|
||||
dispatchAndHandleError(ModLoadingStage.LOAD_REGISTRIES, syncExecutor, parallelExecutor, periodicTask);
|
||||
statusConsumer.ifPresent(c->c.accept("Adding custom tag types"));
|
||||
GameData.setCustomTagTypesFromRegistries();
|
||||
statusConsumer.ifPresent(c->c.accept("Populating registries"));
|
||||
dispatchAndHandleError(ModLoadingStage.LOAD_REGISTRIES, syncExecutor, parallelExecutor, periodicTask);
|
||||
statusConsumer.ifPresent(c->c.accept("Early mod loading complete"));
|
||||
}
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ public class ModLoadingException extends RuntimeException
|
||||
}
|
||||
|
||||
static Stream<ModLoadingException> fromEarlyException(final EarlyLoadingException e) {
|
||||
return e.getAllData().stream().map(ed->new ModLoadingException(null, ModLoadingStage.VALIDATE, ed.getI18message(), e.getCause(), ed.getArgs()));
|
||||
return e.getAllData().stream().map(ed->new ModLoadingException(ed.getModInfo(), ModLoadingStage.VALIDATE, ed.getI18message(), e.getCause(), ed.getArgs()));
|
||||
}
|
||||
|
||||
public String getI18NMessage() {
|
||||
|
||||
@@ -21,18 +21,28 @@ package net.minecraftforge.fml.client.gui;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.AbstractGui;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.vector.Matrix4f;
|
||||
import net.minecraft.util.text.ITextProperties;
|
||||
import net.minecraft.util.text.LanguageMap;
|
||||
import net.minecraft.util.text.Style;
|
||||
import net.minecraftforge.client.event.RenderTooltipEvent;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* This class provides several methods and constants used by the Config GUI classes.
|
||||
@@ -72,6 +82,7 @@ public class GuiUtils
|
||||
* @param borderSize the size of the box's borders
|
||||
* @param zLevel the zLevel to draw at
|
||||
*/
|
||||
@Deprecated //Use matrix stack version TODO remove 1.17
|
||||
public static void drawContinuousTexturedBox(int x, int y, int u, int v, int width, int height, int textureWidth, int textureHeight,
|
||||
int borderSize, float zLevel)
|
||||
{
|
||||
@@ -95,6 +106,7 @@ public class GuiUtils
|
||||
* @param borderSize the size of the box's borders
|
||||
* @param zLevel the zLevel to draw at
|
||||
*/
|
||||
@Deprecated //Use matrix stack version TODO remove 1.17
|
||||
public static void drawContinuousTexturedBox(ResourceLocation res, int x, int y, int u, int v, int width, int height, int textureWidth, int textureHeight,
|
||||
int borderSize, float zLevel)
|
||||
{
|
||||
@@ -121,6 +133,7 @@ public class GuiUtils
|
||||
* @param rightBorder the size of the box's right border
|
||||
* @param zLevel the zLevel to draw at
|
||||
*/
|
||||
@Deprecated //Use matrix stack version TODO remove 1.17
|
||||
public static void drawContinuousTexturedBox(ResourceLocation res, int x, int y, int u, int v, int width, int height, int textureWidth, int textureHeight,
|
||||
int topBorder, int bottomBorder, int leftBorder, int rightBorder, float zLevel)
|
||||
{
|
||||
@@ -147,7 +160,7 @@ public class GuiUtils
|
||||
* @param rightBorder the size of the box's right border
|
||||
* @param zLevel the zLevel to draw at
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
@Deprecated //Use matrix stack version TODO remove 1.17
|
||||
public static void drawContinuousTexturedBox(int x, int y, int u, int v, int width, int height, int textureWidth, int textureHeight,
|
||||
int topBorder, int bottomBorder, int leftBorder, int rightBorder, float zLevel)
|
||||
{
|
||||
@@ -196,6 +209,7 @@ public class GuiUtils
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated //Use matrix stack version TODO remove 1.17
|
||||
public static void drawTexturedModalRect(int x, int y, int u, int v, int width, int height, float zLevel)
|
||||
{
|
||||
final float uScale = 1f / 0x100;
|
||||
@@ -211,6 +225,166 @@ public class GuiUtils
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws a textured box of any size (smallest size is borderSize * 2 square) based on a fixed size textured box with continuous borders
|
||||
* and filler. It is assumed that the desired texture ResourceLocation object has been bound using
|
||||
* Minecraft.getMinecraft().getTextureManager().bindTexture(resourceLocation).
|
||||
*
|
||||
* @param matrixStack the gui matrix stack
|
||||
* @param x x axis offset
|
||||
* @param y y axis offset
|
||||
* @param u bound resource location image x offset
|
||||
* @param v bound resource location image y offset
|
||||
* @param width the desired box width
|
||||
* @param height the desired box height
|
||||
* @param textureWidth the width of the box texture in the resource location image
|
||||
* @param textureHeight the height of the box texture in the resource location image
|
||||
* @param borderSize the size of the box's borders
|
||||
* @param zLevel the zLevel to draw at
|
||||
*/
|
||||
public static void drawContinuousTexturedBox(MatrixStack matrixStack, int x, int y, int u, int v, int width, int height, int textureWidth, int textureHeight,
|
||||
int borderSize, float zLevel)
|
||||
{
|
||||
drawContinuousTexturedBox(matrixStack, x, y, u, v, width, height, textureWidth, textureHeight, borderSize, borderSize, borderSize, borderSize, zLevel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws a textured box of any size (smallest size is borderSize * 2 square) based on a fixed size textured box with continuous borders
|
||||
* and filler. The provided ResourceLocation object will be bound using
|
||||
* Minecraft.getMinecraft().getTextureManager().bindTexture(resourceLocation).
|
||||
*
|
||||
* @param matrixStack the gui matrix stack
|
||||
* @param res the ResourceLocation object that contains the desired image
|
||||
* @param x x axis offset
|
||||
* @param y y axis offset
|
||||
* @param u bound resource location image x offset
|
||||
* @param v bound resource location image y offset
|
||||
* @param width the desired box width
|
||||
* @param height the desired box height
|
||||
* @param textureWidth the width of the box texture in the resource location image
|
||||
* @param textureHeight the height of the box texture in the resource location image
|
||||
* @param borderSize the size of the box's borders
|
||||
* @param zLevel the zLevel to draw at
|
||||
*/
|
||||
public static void drawContinuousTexturedBox(MatrixStack matrixStack, ResourceLocation res, int x, int y, int u, int v, int width, int height, int textureWidth, int textureHeight,
|
||||
int borderSize, float zLevel)
|
||||
{
|
||||
drawContinuousTexturedBox(matrixStack, res, x, y, u, v, width, height, textureWidth, textureHeight, borderSize, borderSize, borderSize, borderSize, zLevel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws a textured box of any size (smallest size is borderSize * 2 square) based on a fixed size textured box with continuous borders
|
||||
* and filler. The provided ResourceLocation object will be bound using
|
||||
* Minecraft.getMinecraft().getTextureManager().bindTexture(resourceLocation).
|
||||
*
|
||||
* @param matrixStack the gui matrix stack
|
||||
* @param res the ResourceLocation object that contains the desired image
|
||||
* @param x x axis offset
|
||||
* @param y y axis offset
|
||||
* @param u bound resource location image x offset
|
||||
* @param v bound resource location image y offset
|
||||
* @param width the desired box width
|
||||
* @param height the desired box height
|
||||
* @param textureWidth the width of the box texture in the resource location image
|
||||
* @param textureHeight the height of the box texture in the resource location image
|
||||
* @param topBorder the size of the box's top border
|
||||
* @param bottomBorder the size of the box's bottom border
|
||||
* @param leftBorder the size of the box's left border
|
||||
* @param rightBorder the size of the box's right border
|
||||
* @param zLevel the zLevel to draw at
|
||||
*/
|
||||
public static void drawContinuousTexturedBox(MatrixStack matrixStack, ResourceLocation res, int x, int y, int u, int v, int width, int height, int textureWidth, int textureHeight,
|
||||
int topBorder, int bottomBorder, int leftBorder, int rightBorder, float zLevel)
|
||||
{
|
||||
Minecraft.getInstance().getTextureManager().bindTexture(res);
|
||||
drawContinuousTexturedBox(matrixStack, x, y, u, v, width, height, textureWidth, textureHeight, topBorder, bottomBorder, leftBorder, rightBorder, zLevel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws a textured box of any size (smallest size is borderSize * 2 square) based on a fixed size textured box with continuous borders
|
||||
* and filler. It is assumed that the desired texture ResourceLocation object has been bound using
|
||||
* Minecraft.getMinecraft().getTextureManager().bindTexture(resourceLocation).
|
||||
*
|
||||
* @param matrixStack the gui matrix stack
|
||||
* @param x x axis offset
|
||||
* @param y y axis offset
|
||||
* @param u bound resource location image x offset
|
||||
* @param v bound resource location image y offset
|
||||
* @param width the desired box width
|
||||
* @param height the desired box height
|
||||
* @param textureWidth the width of the box texture in the resource location image
|
||||
* @param textureHeight the height of the box texture in the resource location image
|
||||
* @param topBorder the size of the box's top border
|
||||
* @param bottomBorder the size of the box's bottom border
|
||||
* @param leftBorder the size of the box's left border
|
||||
* @param rightBorder the size of the box's right border
|
||||
* @param zLevel the zLevel to draw at
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public static void drawContinuousTexturedBox(MatrixStack matrixStack, int x, int y, int u, int v, int width, int height, int textureWidth, int textureHeight,
|
||||
int topBorder, int bottomBorder, int leftBorder, int rightBorder, float zLevel)
|
||||
{
|
||||
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.blendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0);
|
||||
|
||||
int fillerWidth = textureWidth - leftBorder - rightBorder;
|
||||
int fillerHeight = textureHeight - topBorder - bottomBorder;
|
||||
int canvasWidth = width - leftBorder - rightBorder;
|
||||
int canvasHeight = height - topBorder - bottomBorder;
|
||||
int xPasses = canvasWidth / fillerWidth;
|
||||
int remainderWidth = canvasWidth % fillerWidth;
|
||||
int yPasses = canvasHeight / fillerHeight;
|
||||
int remainderHeight = canvasHeight % fillerHeight;
|
||||
|
||||
// Draw Border
|
||||
// Top Left
|
||||
drawTexturedModalRect(matrixStack, x, y, u, v, leftBorder, topBorder, zLevel);
|
||||
// Top Right
|
||||
drawTexturedModalRect(matrixStack, x + leftBorder + canvasWidth, y, u + leftBorder + fillerWidth, v, rightBorder, topBorder, zLevel);
|
||||
// Bottom Left
|
||||
drawTexturedModalRect(matrixStack, x, y + topBorder + canvasHeight, u, v + topBorder + fillerHeight, leftBorder, bottomBorder, zLevel);
|
||||
// Bottom Right
|
||||
drawTexturedModalRect(matrixStack, x + leftBorder + canvasWidth, y + topBorder + canvasHeight, u + leftBorder + fillerWidth, v + topBorder + fillerHeight, rightBorder, bottomBorder, zLevel);
|
||||
|
||||
for (int i = 0; i < xPasses + (remainderWidth > 0 ? 1 : 0); i++)
|
||||
{
|
||||
// Top Border
|
||||
drawTexturedModalRect(matrixStack, x + leftBorder + (i * fillerWidth), y, u + leftBorder, v, (i == xPasses ? remainderWidth : fillerWidth), topBorder, zLevel);
|
||||
// Bottom Border
|
||||
drawTexturedModalRect(matrixStack, x + leftBorder + (i * fillerWidth), y + topBorder + canvasHeight, u + leftBorder, v + topBorder + fillerHeight, (i == xPasses ? remainderWidth : fillerWidth), bottomBorder, zLevel);
|
||||
|
||||
// Throw in some filler for good measure
|
||||
for (int j = 0; j < yPasses + (remainderHeight > 0 ? 1 : 0); j++)
|
||||
drawTexturedModalRect(matrixStack, x + leftBorder + (i * fillerWidth), y + topBorder + (j * fillerHeight), u + leftBorder, v + topBorder, (i == xPasses ? remainderWidth : fillerWidth), (j == yPasses ? remainderHeight : fillerHeight), zLevel);
|
||||
}
|
||||
|
||||
// Side Borders
|
||||
for (int j = 0; j < yPasses + (remainderHeight > 0 ? 1 : 0); j++)
|
||||
{
|
||||
// Left Border
|
||||
drawTexturedModalRect(matrixStack, x, y + topBorder + (j * fillerHeight), u, v + topBorder, leftBorder, (j == yPasses ? remainderHeight : fillerHeight), zLevel);
|
||||
// Right Border
|
||||
drawTexturedModalRect(matrixStack, x + leftBorder + canvasWidth, y + topBorder + (j * fillerHeight), u + leftBorder + fillerWidth, v + topBorder, rightBorder, (j == yPasses ? remainderHeight : fillerHeight), zLevel);
|
||||
}
|
||||
}
|
||||
|
||||
public static void drawTexturedModalRect(MatrixStack matrixStack, int x, int y, int u, int v, int width, int height, float zLevel)
|
||||
{
|
||||
final float uScale = 1f / 0x100;
|
||||
final float vScale = 1f / 0x100;
|
||||
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
BufferBuilder wr = tessellator.getBuffer();
|
||||
wr.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
|
||||
Matrix4f matrix = matrixStack.getLast().getMatrix();
|
||||
wr.pos(matrix, x , y + height, zLevel).tex( u * uScale, ((v + height) * vScale)).endVertex();
|
||||
wr.pos(matrix, x + width, y + height, zLevel).tex((u + width) * uScale, ((v + height) * vScale)).endVertex();
|
||||
wr.pos(matrix, x + width, y , zLevel).tex((u + width) * uScale, ( v * vScale)).endVertex();
|
||||
wr.pos(matrix, x , y , zLevel).tex( u * uScale, ( v * vScale)).endVertex();
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
private static ItemStack cachedTooltipStack = ItemStack.EMPTY;
|
||||
|
||||
@@ -232,8 +406,7 @@ public class GuiUtils
|
||||
cachedTooltipStack = ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
/*
|
||||
public static void drawHoveringText(MatrixStack mStack, List<? extends IReorderingProcessor> textLines, int mouseX, int mouseY, int screenWidth, int screenHeight, int maxTextWidth, FontRenderer font)
|
||||
public static void drawHoveringText(MatrixStack mStack, List<? extends ITextProperties> textLines, int mouseX, int mouseY, int screenWidth, int screenHeight, int maxTextWidth, FontRenderer font)
|
||||
{
|
||||
drawHoveringText(mStack, textLines, mouseX, mouseY, screenWidth, screenHeight, maxTextWidth, DEFAULT_BACKGROUND_COLOR, DEFAULT_BORDER_COLOR_START, DEFAULT_BORDER_COLOR_END, font);
|
||||
}
|
||||
@@ -256,8 +429,8 @@ public class GuiUtils
|
||||
* @param borderColorEnd The ending color of the box border. The border color will be smoothly interpolated
|
||||
* between the start and end values.
|
||||
* @param font the font for drawing the text in the tooltip box
|
||||
* /
|
||||
public static void drawHoveringText(MatrixStack mStack, List<? extends IReorderingProcessor> textLines, int mouseX, int mouseY, int screenWidth, int screenHeight,
|
||||
*/
|
||||
public static void drawHoveringText(MatrixStack mStack, List<? extends ITextProperties> textLines, int mouseX, int mouseY, int screenWidth, int screenHeight,
|
||||
int maxTextWidth, int backgroundColor, int borderColorStart, int borderColorEnd, FontRenderer font)
|
||||
{
|
||||
drawHoveringText(cachedTooltipStack, mStack, textLines, mouseX, mouseY, screenWidth, screenHeight, maxTextWidth, backgroundColor, borderColorStart, borderColorEnd, font);
|
||||
@@ -272,9 +445,9 @@ public class GuiUtils
|
||||
* Use this version if calling from somewhere where ItemStack context is available.
|
||||
*
|
||||
* @see #drawHoveringText(MatrixStack, List, int, int, int, int, int, int, int, int, FontRenderer)
|
||||
* /
|
||||
*/
|
||||
//TODO, Validate rendering is the same as the original
|
||||
public static void drawHoveringText(@Nonnull final ItemStack stack, MatrixStack mStack, List<? extends IReorderingProcessor> textLines, int mouseX, int mouseY,
|
||||
public static void drawHoveringText(@Nonnull final ItemStack stack, MatrixStack mStack, List<? extends ITextProperties> textLines, int mouseX, int mouseY,
|
||||
int screenWidth, int screenHeight, int maxTextWidth,
|
||||
int backgroundColor, int borderColorStart, int borderColorEnd, FontRenderer font)
|
||||
{
|
||||
@@ -294,7 +467,7 @@ public class GuiUtils
|
||||
RenderSystem.disableDepthTest();
|
||||
int tooltipTextWidth = 0;
|
||||
|
||||
for (IReorderingProcessor textLine : textLines)
|
||||
for (ITextProperties textLine : textLines)
|
||||
{
|
||||
int textLineWidth = font.func_238414_a_(textLine);
|
||||
if (textLineWidth > tooltipTextWidth)
|
||||
@@ -331,7 +504,7 @@ public class GuiUtils
|
||||
for (int i = 0; i < textLines.size(); i++)
|
||||
{
|
||||
ITextProperties textLine = textLines.get(i);
|
||||
List<ITextProperties> wrappedLine = font.func_238425_b_(textLine, tooltipTextWidth);
|
||||
List<ITextProperties> wrappedLine = font.func_238420_b_().func_238362_b_(textLine, tooltipTextWidth, Style.field_240709_b_);
|
||||
if (i == 0)
|
||||
titleLinesCount = wrappedLine.size();
|
||||
|
||||
@@ -398,7 +571,7 @@ public class GuiUtils
|
||||
{
|
||||
ITextProperties line = textLines.get(lineNumber);
|
||||
if (line != null)
|
||||
font.func_238416_a_(line, (float)tooltipX, (float)tooltipY, -1, true, mat, renderType, false, 0, 15728880);
|
||||
font.func_238416_a_(LanguageMap.getInstance().func_241870_a(line), (float)tooltipX, (float)tooltipY, -1, true, mat, renderType, false, 0, 15728880);
|
||||
|
||||
if (lineNumber + 1 == titleLinesCount)
|
||||
tooltipY += 2;
|
||||
@@ -415,7 +588,6 @@ public class GuiUtils
|
||||
RenderSystem.enableRescaleNormal();
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public static void drawGradientRect(Matrix4f mat, int zLevel, int left, int top, int right, int bottom, int startColor, int endColor)
|
||||
|
||||
@@ -54,7 +54,7 @@ public class ExtendedButton extends Button
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
this.field_230692_n_ = mouseX >= this.field_230690_l_ && mouseY >= this.field_230691_m_ && mouseX < this.field_230690_l_ + this.field_230688_j_ && mouseY < this.field_230691_m_ + this.field_230689_k_;
|
||||
int k = this.func_230989_a_(this.func_230449_g_());
|
||||
GuiUtils.drawContinuousTexturedBox(field_230687_i_, this.field_230690_l_, this.field_230691_m_, 0, 46 + k * 20, this.field_230688_j_, this.field_230689_k_, 200, 20, 2, 3, 2, 2, this.func_230927_p_());
|
||||
GuiUtils.drawContinuousTexturedBox(mStack, field_230687_i_, this.field_230690_l_, this.field_230691_m_, 0, 46 + k * 20, this.field_230688_j_, this.field_230689_k_, 200, 20, 2, 3, 2, 2, this.func_230927_p_());
|
||||
this.func_230441_a_(mStack, mc, mouseX, mouseY);
|
||||
|
||||
ITextComponent buttonText = this.func_230458_i_();
|
||||
|
||||
@@ -118,7 +118,7 @@ public class Slider extends ExtendedButton
|
||||
updateSlider();
|
||||
}
|
||||
|
||||
GuiUtils.drawContinuousTexturedBox(field_230687_i_, this.field_230690_l_ + (int)(this.sliderValue * (float)(this.field_230688_j_ - 8)), this.field_230691_m_, 0, 66, 8, this.field_230689_k_, 200, 20, 2, 3, 2, 2, this.func_230927_p_());
|
||||
GuiUtils.drawContinuousTexturedBox(mStack, field_230687_i_, this.field_230690_l_ + (int)(this.sliderValue * (float)(this.field_230688_j_ - 8)), this.field_230691_m_, 0, 66, 8, this.field_230689_k_, 200, 20, 2, 3, 2, 2, this.func_230927_p_());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ public class UnicodeGlyphButton extends ExtendedButton
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
this.field_230692_n_ = mouseX >= this.field_230690_l_ && mouseY >= this.field_230691_m_ && mouseX < this.field_230690_l_ + this.field_230688_j_ && mouseY < this.field_230691_m_ + this.field_230689_k_;
|
||||
int k = this.func_230989_a_(this.field_230692_n_);
|
||||
GuiUtils.drawContinuousTexturedBox(Button.field_230687_i_, this.field_230690_l_, this.field_230691_m_, 0, 46 + k * 20, this.field_230688_j_, this.field_230689_k_, 200, 20, 2, 3, 2, 2, this.func_230927_p_());
|
||||
GuiUtils.drawContinuousTexturedBox(mStack, Button.field_230687_i_, this.field_230690_l_, this.field_230691_m_, 0, 46 + k * 20, this.field_230688_j_, this.field_230689_k_, 200, 20, 2, 3, 2, 2, this.func_230927_p_());
|
||||
this.func_230441_a_(mStack, mc, mouseX, mouseY);
|
||||
|
||||
ITextComponent buttonText = this.func_230442_c_();
|
||||
|
||||
@@ -26,7 +26,6 @@ import com.google.common.collect.Multimap;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.IHasContainer;
|
||||
import net.minecraft.client.gui.ScreenManager;
|
||||
@@ -34,10 +33,8 @@ import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.world.ClientWorld;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.fluid.Fluid;
|
||||
import net.minecraft.inventory.container.Container;
|
||||
import net.minecraft.inventory.container.ContainerType;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.tags.ITag;
|
||||
import net.minecraft.tags.ITagCollection;
|
||||
@@ -414,39 +411,8 @@ public class FMLPlayMessages
|
||||
// to the last working set of tags
|
||||
//Note: We gracefully ignore any tag types the server may have that we don't as they won't be in our tag registry
|
||||
// so they won't be validated
|
||||
Multimap<ResourceLocation, ResourceLocation> missingTags = TagRegistryManager.func_242198_b(new ITagCollectionSupplier()
|
||||
{
|
||||
@Override
|
||||
public ITagCollection<Block> func_241835_a()
|
||||
{
|
||||
return tagCollectionSupplier.func_241835_a();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITagCollection<Item> func_241836_b()
|
||||
{
|
||||
return tagCollectionSupplier.func_241836_b();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITagCollection<Fluid> func_241837_c()
|
||||
{
|
||||
return tagCollectionSupplier.func_241837_c();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITagCollection<EntityType<?>> func_241838_d()
|
||||
{
|
||||
return tagCollectionSupplier.func_241838_d();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<ResourceLocation, ITagCollection<?>> getCustomTagTypes()
|
||||
{
|
||||
//Override and use the tags from the packet to test for validation before we actually set them
|
||||
return msg.customTagTypeCollections;
|
||||
}
|
||||
});
|
||||
//Override and use the tags from the packet to test for validation before we actually set them
|
||||
Multimap<ResourceLocation, ResourceLocation> missingTags = TagRegistryManager.func_242198_b(ForgeTagHandler.withSpecificCustom(tagCollectionSupplier, msg.customTagTypeCollections));
|
||||
if (missingTags.isEmpty())
|
||||
{
|
||||
//If we have no missing tags, update the custom tag types
|
||||
|
||||
@@ -119,9 +119,14 @@ public class NetworkHooks
|
||||
FMLNetworkConstants.playChannel.sendTo(new FMLPlayMessages.DimensionInfoMessage(player.dimension), manager, NetworkDirection.PLAY_TO_CLIENT);
|
||||
}*/
|
||||
|
||||
public static void handleClientLoginSuccess(NetworkManager manager) {
|
||||
public static boolean isVanillaConnection(NetworkManager manager)
|
||||
{
|
||||
if (manager == null || manager.channel() == null) throw new NullPointerException("ARGH! Network Manager is null (" + manager != null ? "CHANNEL" : "MANAGER"+")" );
|
||||
if (getConnectionType(()->manager) == ConnectionType.VANILLA) {
|
||||
return getConnectionType(() -> manager) == ConnectionType.VANILLA;
|
||||
}
|
||||
|
||||
public static void handleClientLoginSuccess(NetworkManager manager) {
|
||||
if (isVanillaConnection(manager)) {
|
||||
LOGGER.info("Connected to a vanilla server. Catching up missing behaviour.");
|
||||
ConfigTracker.INSTANCE.loadDefaultServerConfigs();
|
||||
} else {
|
||||
|
||||
@@ -179,7 +179,7 @@ public class GameData
|
||||
makeRegistry(TREE_DECORATOR_TYPES, c(TreeDecoratorType.class)).disableSaving().disableSync().create();
|
||||
|
||||
// Dynamic Worldgen
|
||||
makeRegistry(BIOMES, Biome.class).tagFolder("biomes").create();
|
||||
makeRegistry(BIOMES, Biome.class).create();
|
||||
|
||||
// Custom forge registries
|
||||
makeRegistry(DATA_SERIALIZERS, DataSerializerEntry.class, 256 /*vanilla space*/, MAX_VARINT).disableSaving().disableOverrides().addCallback(SerializerCallbacks.INSTANCE).create();
|
||||
|
||||
@@ -96,6 +96,13 @@ class NamespacedDefaultedWrapper<T extends IForgeRegistryEntry<T>> extends Defau
|
||||
return this.delegate.getValue(name); //getOrDefault
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public T func_230516_a_(@Nullable RegistryKey<T> name)
|
||||
{
|
||||
return name == null ? null : this.delegate.getRaw(name.func_240901_a_()); //get without default
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public ResourceLocation getKey(T value)
|
||||
|
||||
@@ -94,6 +94,13 @@ class NamespacedWrapper<T extends IForgeRegistryEntry<T>> extends SimpleRegistry
|
||||
return Optional.ofNullable( this.delegate.getRaw(name)); //get without default
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public T func_230516_a_(@Nullable RegistryKey<T> name)
|
||||
{
|
||||
return name == null ? null : this.delegate.getRaw(name.func_240901_a_()); //get without default
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public ResourceLocation getKey(T value)
|
||||
|
||||
@@ -176,6 +176,7 @@ private-f net.minecraft.client.renderer.model.ModelBakery field_217853_J # field
|
||||
protected net.minecraft.client.renderer.model.ModelBakery func_177594_c(Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/client/renderer/model/BlockModel; # loadModel
|
||||
private-f net.minecraft.client.renderer.tileentity.PistonTileEntityRenderer field_178462_c # blockRenderer - it's static so we need to un-finalize in case this class loads to early.
|
||||
public net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher field_147557_n # fontRenderer - needed for rendering text in TESR items before entering world
|
||||
default net.minecraft.client.settings.KeyBinding field_74513_e # pressed
|
||||
public net.minecraft.command.arguments.EntityOptions func_202024_a(Ljava/lang/String;Lnet/minecraft/command/arguments/EntityOptions$IFilter;Ljava/util/function/Predicate;Lnet/minecraft/util/text/ITextComponent;)V # register
|
||||
public net.minecraft.command.arguments.EntitySelectorParser func_197396_n()V # updateFilter
|
||||
public net.minecraft.command.arguments.EntitySelectorParser func_197404_d()V # parseArguments
|
||||
@@ -298,6 +299,21 @@ public net.minecraft.world.World field_73003_n #prevRainingStrength
|
||||
public net.minecraft.world.World field_73004_o #rainingStrength
|
||||
public net.minecraft.world.World field_73017_q #thunderingStrength
|
||||
public net.minecraft.world.World field_73018_p #prevThunderingStrength
|
||||
public net.minecraft.world.biome.Biome$Climate
|
||||
public net.minecraft.world.biome.Biome$Climate <init>(Lnet/minecraft/world/biome/Biome$RainType;FLnet/minecraft/world/biome/Biome$TemperatureModifier;F)V
|
||||
public net.minecraft.world.biome.Biome$Climate field_242460_b # precipitation
|
||||
public net.minecraft.world.biome.Biome$Climate field_242461_c # temperature
|
||||
public net.minecraft.world.biome.Biome$Climate field_242462_d # temperatureModifier
|
||||
public net.minecraft.world.biome.Biome$Climate field_242463_e # downfall
|
||||
protected net.minecraft.world.biome.BiomeGenerationSettings$Builder field_242504_a
|
||||
protected net.minecraft.world.biome.BiomeGenerationSettings$Builder field_242505_b
|
||||
protected net.minecraft.world.biome.BiomeGenerationSettings$Builder field_242506_c
|
||||
protected net.minecraft.world.biome.BiomeGenerationSettings$Builder field_242507_d
|
||||
protected net.minecraft.world.biome.BiomeGenerationSettings$Builder func_242509_a(I)V # populateStageEntries
|
||||
protected net.minecraft.world.biome.MobSpawnInfo$Builder field_242567_a
|
||||
protected net.minecraft.world.biome.MobSpawnInfo$Builder field_242568_b
|
||||
protected net.minecraft.world.biome.MobSpawnInfo$Builder field_242569_c
|
||||
protected net.minecraft.world.biome.MobSpawnInfo$Builder field_242570_d
|
||||
public net.minecraft.world.chunk.ChunkStatus <init>(Ljava/lang/String;Lnet/minecraft/world/chunk/ChunkStatus;ILjava/util/EnumSet;Lnet/minecraft/world/chunk/ChunkStatus$Type;Lnet/minecraft/world/chunk/ChunkStatus$IGenerationWorker;Lnet/minecraft/world/chunk/ChunkStatus$ILoadingWorker;)V
|
||||
private-f net.minecraft.world.gen.DebugChunkGenerator field_177462_b #GRID_WIDTH
|
||||
private-f net.minecraft.world.gen.DebugChunkGenerator field_177464_a #ALL_VALID_STATES
|
||||
|
||||
@@ -58,6 +58,7 @@
|
||||
"fml.modloading.brokenfile.optifine": "File {2} is an incompatible version of OptiFine",
|
||||
"fml.modloading.brokenfile.invalidzip": "File {2} is not a jar file",
|
||||
"fml.modloading.brokenresources": "File {2} failed to load a valid ResourcePackInfo",
|
||||
"fml.modloading.missinglicense": "Missing License Information in file {3}",
|
||||
"fml.resources.modresources": "Resources for {0} mod files",
|
||||
|
||||
"fml.messages.artifactversion.ornotinstalled":"{0,ornull,fml.messages.artifactversion.notinstalled}",
|
||||
|
||||
@@ -93,4 +93,17 @@ net/minecraft/util/math/vector/Vector3d func_216371_e()Lnet/minecraft/util/math/
|
||||
net/minecraft/util/math/vector/Vector3d func_189984_a(Lnet/minecraft/util/math/vector/Vector2f;)Lnet/minecraft/util/math/vector/Vector3d; # fromPitchYaw
|
||||
net/minecraft/util/math/vector/Vector3d func_189986_a(FF)Lnet/minecraft/util/math/vector/Vector3d; # fromPitchYaw
|
||||
net/minecraft/util/text/Style func_240719_a_(Lnet/minecraft/util/ResourceLocation;)Lnet/minecraft/util/text/Style; #setFontId
|
||||
net/minecraft/util/text/Style func_240723_c_(Lnet/minecraft/util/text/TextFormatting;)Lnet/minecraft/util/text/Style; #forceFormatting
|
||||
net/minecraft/util/text/Style func_240723_c_(Lnet/minecraft/util/text/TextFormatting;)Lnet/minecraft/util/text/Style; #forceFormatting
|
||||
# BiomeAmbiance getters, needed for it to be useful during BiomeLoadingEvent to be useful
|
||||
net/minecraft/world/biome/BiomeAmbience func_235213_a_()I # getFogColor
|
||||
net/minecraft/world/biome/BiomeAmbience func_235216_b_()I # getWaterColor
|
||||
net/minecraft/world/biome/BiomeAmbience func_235218_c_()I # getWaterFogColor
|
||||
net/minecraft/world/biome/BiomeAmbience func_242527_d()I # getSkyColor
|
||||
net/minecraft/world/biome/BiomeAmbience func_242528_e()Ljava/util/Optional; # getFoliageColor
|
||||
net/minecraft/world/biome/BiomeAmbience func_242529_f()Ljava/util/Optional; # getGrassColor
|
||||
net/minecraft/world/biome/BiomeAmbience func_242531_g()Lnet/minecraft/world/biome/BiomeAmbience$GrassColorModifier; # getGrassColorModifier
|
||||
net/minecraft/world/biome/BiomeAmbience func_235220_d_()Ljava/util/Optional; # getParticle
|
||||
net/minecraft/world/biome/BiomeAmbience func_235222_e_()Ljava/util/Optional; # getAmbientSound
|
||||
net/minecraft/world/biome/BiomeAmbience func_235224_f_()Ljava/util/Optional; # getMoodSound
|
||||
net/minecraft/world/biome/BiomeAmbience func_235226_g_()Ljava/util/Optional; # getAdditionsSound
|
||||
net/minecraft/world/biome/BiomeAmbience func_235228_h_()Ljava/util/Optional; # getMusic
|
||||
@@ -22,10 +22,16 @@ package net.minecraftforge.debug;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraftforge.common.brewing.BrewingRecipeRegistry;
|
||||
import net.minecraftforge.event.entity.living.PotionEvent;
|
||||
import net.minecraftforge.eventbus.api.Event.Result;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
||||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||
|
||||
@Mod("potion_event_test")
|
||||
@Mod.EventBusSubscriber
|
||||
@@ -33,6 +39,16 @@ public class PotionEventTest
|
||||
{
|
||||
private static Logger LOGGER = LogManager.getLogger(PotionEventTest.class);
|
||||
|
||||
public PotionEventTest()
|
||||
{
|
||||
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::onSetup);
|
||||
}
|
||||
|
||||
private void onSetup(FMLCommonSetupEvent event)
|
||||
{
|
||||
BrewingRecipeRegistry.addRecipe(Ingredient.fromItems(Items.ICE), Ingredient.fromItems(Items.LAVA_BUCKET), new ItemStack(Items.OBSIDIAN));
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onPotionAdded(PotionEvent.PotionAddedEvent event)
|
||||
{
|
||||
|
||||
@@ -1,3 +1,22 @@
|
||||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2020.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation version 2.1
|
||||
* of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
package net.minecraftforge.debug.block;
|
||||
|
||||
import net.minecraft.block.AbstractBlock;
|
||||
|
||||
@@ -19,44 +19,54 @@
|
||||
|
||||
package net.minecraftforge.debug.misc;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
import java.util.Set;
|
||||
import java.util.function.Supplier;
|
||||
import javax.annotation.Nullable;
|
||||
import net.minecraft.data.DataGenerator;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.tags.ITag;
|
||||
import net.minecraft.tags.ItemTags;
|
||||
import net.minecraft.tags.TagCollectionManager;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.biome.Biomes;
|
||||
import net.minecraftforge.common.ForgeTagHandler;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.data.ExistingFileHelper;
|
||||
import net.minecraftforge.common.data.ForgeRegistryTagsProvider;
|
||||
import net.minecraftforge.common.util.ReverseTagWrapper;
|
||||
import net.minecraftforge.event.entity.ProjectileImpactEvent;
|
||||
import net.minecraftforge.eventbus.api.IEventBus;
|
||||
import net.minecraftforge.fml.RegistryObject;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.event.lifecycle.GatherDataEvent;
|
||||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||
import net.minecraftforge.registries.DeferredRegister;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.minecraftforge.registries.ForgeRegistryEntry;
|
||||
import net.minecraftforge.registries.IForgeRegistry;
|
||||
import net.minecraftforge.registries.RegistryBuilder;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@Mod(CustomTagTypesTest.MODID)
|
||||
public class CustomTagTypesTest
|
||||
{
|
||||
public static final String MODID = "custom_tag_types_test";
|
||||
private static final Logger LOGGER = LogManager.getLogger(MODID);
|
||||
private static final ResourceLocation customRegistryName = new ResourceLocation(MODID, "custom_type_registry");
|
||||
private static final DeferredRegister<Custom> CUSTOMS = DeferredRegister.create(Custom.class, MODID);
|
||||
private static final RegistryObject<Custom> CUSTOM = CUSTOMS.register("custom", Custom::new);
|
||||
private static final Supplier<IForgeRegistry<Custom>> CUSTOM_REG = CUSTOMS.makeRegistry(customRegistryName.getPath(),
|
||||
() -> new RegistryBuilder<Custom>().tagFolder(MODID + "/custom_types"));
|
||||
private static final ITag.INamedTag<Biome> OCEANS = ForgeTagHandler.makeWrapperTag(ForgeRegistries.BIOMES, new ResourceLocation(MODID, "oceans"));
|
||||
private static final ITag.INamedTag<Custom> TESTS = ForgeTagHandler.makeWrapperTag(customRegistryName, new ResourceLocation(MODID, "tests"));
|
||||
private static final ITag.INamedTag<Custom> TESTS = ForgeTagHandler.createOptionalTag(customRegistryName, new ResourceLocation(MODID, "tests"), Sets.newHashSet(CUSTOM));
|
||||
private static final ITag.INamedTag<Item> OPTIONAL_TEST = ItemTags.createOptional(new ResourceLocation(MODID, "optional_test"), Sets.newHashSet(() -> Items.BONE));
|
||||
|
||||
public CustomTagTypesTest()
|
||||
{
|
||||
IEventBus modBus = FMLJavaModLoadingContext.get().getModEventBus();
|
||||
CUSTOMS.register(modBus);
|
||||
modBus.addListener(this::gatherData);
|
||||
MinecraftForge.EVENT_BUS.addListener(this::projectileImpact);
|
||||
}
|
||||
|
||||
private void gatherData(GatherDataEvent event)
|
||||
@@ -64,32 +74,27 @@ public class CustomTagTypesTest
|
||||
if (event.includeServer())
|
||||
{
|
||||
DataGenerator gen = event.getGenerator();
|
||||
ExistingFileHelper existingFileHelper = event.getExistingFileHelper();
|
||||
gen.addProvider(new BiomeTags(gen, existingFileHelper));
|
||||
gen.addProvider(new CustomRegistryTags(gen, existingFileHelper));
|
||||
gen.addProvider(new CustomRegistryTags(gen, event.getExistingFileHelper()));
|
||||
}
|
||||
}
|
||||
|
||||
public static class Custom extends ForgeRegistryEntry<Custom> {
|
||||
}
|
||||
|
||||
public static class BiomeTags extends ForgeRegistryTagsProvider<Biome>
|
||||
private void projectileImpact(ProjectileImpactEvent.Arrow event)
|
||||
{
|
||||
public BiomeTags(DataGenerator gen, @Nullable ExistingFileHelper existingFileHelper)
|
||||
LOGGER.info("{} {} {}", Items.BONE.getTags(), OPTIONAL_TEST.func_230236_b_().size(), TagCollectionManager.func_242178_a().func_241836_b().get(new ResourceLocation(MODID, "optional_test")));
|
||||
}
|
||||
|
||||
public static class Custom extends ForgeRegistryEntry<Custom>
|
||||
{
|
||||
private final ReverseTagWrapper<Custom> reverseTags = new ReverseTagWrapper<>(this, () -> TagCollectionManager.func_242178_a().getCustomTypeCollection(CUSTOM_REG.get()));
|
||||
|
||||
public Set<ResourceLocation> getTags()
|
||||
{
|
||||
super(gen, ForgeRegistries.BIOMES, MODID, existingFileHelper);
|
||||
return reverseTags.getTagNames();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerTags()
|
||||
public boolean isIn(ITag<Custom> tag)
|
||||
{
|
||||
func_240522_a_(OCEANS).add(Biomes.OCEAN, Biomes.FROZEN_OCEAN, Biomes.DEEP_OCEAN, Biomes.WARM_OCEAN, Biomes.LUKEWARM_OCEAN,
|
||||
Biomes.COLD_OCEAN, Biomes.DEEP_WARM_OCEAN, Biomes.DEEP_LUKEWARM_OCEAN, Biomes.DEEP_COLD_OCEAN, Biomes.DEEP_FROZEN_OCEAN);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "Biome Tags";
|
||||
return tag.func_230235_a_(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package net.minecraftforge.debug.world;
|
||||
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.world.BiomeLoadingEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@Mod(BiomeLoadingEventTest.MODID)
|
||||
public class BiomeLoadingEventTest {
|
||||
static final String MODID = "biome_loading_event_test";
|
||||
private static final Logger LOGGER = LogManager.getLogger(MODID);
|
||||
private static final boolean ENABLED = false;
|
||||
public BiomeLoadingEventTest(){
|
||||
if(ENABLED) {
|
||||
MinecraftForge.EVENT_BUS.addListener(this::onBiomeLoading);
|
||||
}
|
||||
}
|
||||
public void onBiomeLoading(BiomeLoadingEvent event){
|
||||
ResourceLocation biome = event.getName();
|
||||
LOGGER.info(String.format("Biome loaded: %s", biome.toString()));
|
||||
}
|
||||
}
|
||||
@@ -84,3 +84,5 @@ license="LGPL v2.1"
|
||||
modId="scaffolding_test"
|
||||
[[mods]]
|
||||
modId="custom_tag_types_test"
|
||||
[[mods]]
|
||||
modId="biome_loading_event_test"
|
||||
@@ -0,0 +1,164 @@
|
||||
{
|
||||
"scale": 0.05,
|
||||
"effects": {
|
||||
"mood_sound": {
|
||||
"sound": "minecraft:ambient.cave",
|
||||
"tick_delay": 6000,
|
||||
"block_search_extent": 8,
|
||||
"offset": 2.0
|
||||
},
|
||||
"foliage_color": 16711680,
|
||||
"grass_color": 7348484,
|
||||
"sky_color": 5963796,
|
||||
"fog_color": 12638463,
|
||||
"water_color": 0,
|
||||
"water_fog_color": 0
|
||||
},
|
||||
"surface_builder": "minecraft:desert",
|
||||
"carvers": {
|
||||
"air": [
|
||||
"minecraft:cave",
|
||||
"minecraft:canyon"
|
||||
]
|
||||
},
|
||||
"features": [
|
||||
[],
|
||||
[
|
||||
"minecraft:lake_lava"
|
||||
],
|
||||
[],
|
||||
[
|
||||
"minecraft:fossil",
|
||||
"minecraft:monster_room"
|
||||
],
|
||||
[
|
||||
"minecraft:desert_well"
|
||||
],
|
||||
[],
|
||||
[
|
||||
"minecraft:ore_dirt",
|
||||
"minecraft:ore_gravel",
|
||||
"minecraft:ore_granite",
|
||||
"minecraft:ore_diorite",
|
||||
"minecraft:ore_andesite",
|
||||
"minecraft:ore_coal",
|
||||
"minecraft:ore_iron",
|
||||
"minecraft:ore_gold",
|
||||
"minecraft:ore_redstone",
|
||||
"minecraft:ore_diamond",
|
||||
"minecraft:ore_lapis",
|
||||
"minecraft:disk_sand",
|
||||
"minecraft:disk_clay",
|
||||
"minecraft:disk_gravel"
|
||||
|
||||
],
|
||||
[],
|
||||
[
|
||||
"minecraft:flower_default",
|
||||
"minecraft:patch_grass_badlands",
|
||||
"minecraft:patch_dead_bush_2",
|
||||
"minecraft:brown_mushroom_normal",
|
||||
"minecraft:red_mushroom_normal",
|
||||
"minecraft:patch_sugar_cane_desert",
|
||||
"minecraft:patch_pumpkin",
|
||||
"minecraft:patch_cactus_desert",
|
||||
"minecraft:spring_water",
|
||||
"minecraft:spring_lava"
|
||||
],
|
||||
[
|
||||
"minecraft:freeze_top_layer"
|
||||
]
|
||||
],
|
||||
"starts": [
|
||||
"minecraft:village_desert",
|
||||
"minecraft:pillager_outpost",
|
||||
"minecraft:desert_pyramid",
|
||||
"minecraft:mineshaft",
|
||||
"minecraft:stronghold",
|
||||
"minecraft:ruined_portal_desert"
|
||||
],
|
||||
"spawners": {
|
||||
"monster": [
|
||||
{
|
||||
"type": "minecraft:spider",
|
||||
"weight": 100,
|
||||
"minCount": 4,
|
||||
"maxCount": 4
|
||||
},
|
||||
{
|
||||
"type": "minecraft:zombie",
|
||||
"weight": 19,
|
||||
"minCount": 4,
|
||||
"maxCount": 4
|
||||
},
|
||||
{
|
||||
"type": "minecraft:zombie_villager",
|
||||
"weight": 1,
|
||||
"minCount": 1,
|
||||
"maxCount": 1
|
||||
},
|
||||
{
|
||||
"type": "minecraft:skeleton",
|
||||
"weight": 100,
|
||||
"minCount": 4,
|
||||
"maxCount": 4
|
||||
},
|
||||
{
|
||||
"type": "minecraft:creeper",
|
||||
"weight": 100,
|
||||
"minCount": 4,
|
||||
"maxCount": 4
|
||||
},
|
||||
{
|
||||
"type": "minecraft:slime",
|
||||
"weight": 100,
|
||||
"minCount": 4,
|
||||
"maxCount": 4
|
||||
},
|
||||
{
|
||||
"type": "minecraft:enderman",
|
||||
"weight": 10,
|
||||
"minCount": 1,
|
||||
"maxCount": 4
|
||||
},
|
||||
{
|
||||
"type": "minecraft:witch",
|
||||
"weight": 5,
|
||||
"minCount": 1,
|
||||
"maxCount": 1
|
||||
},
|
||||
{
|
||||
"type": "minecraft:husk",
|
||||
"weight": 80,
|
||||
"minCount": 4,
|
||||
"maxCount": 4
|
||||
}
|
||||
],
|
||||
"creature": [
|
||||
{
|
||||
"type": "minecraft:rabbit",
|
||||
"weight": 4,
|
||||
"minCount": 2,
|
||||
"maxCount": 3
|
||||
}
|
||||
],
|
||||
"ambient": [
|
||||
{
|
||||
"type": "minecraft:bat",
|
||||
"weight": 10,
|
||||
"minCount": 8,
|
||||
"maxCount": 8
|
||||
}
|
||||
],
|
||||
"water_creature": [],
|
||||
"water_ambient": [],
|
||||
"misc": []
|
||||
},
|
||||
"spawn_costs": {},
|
||||
"player_spawn_friendly": false,
|
||||
"precipitation": "none",
|
||||
"temperature": 2.0,
|
||||
"downfall": 0.0,
|
||||
"category": "desert",
|
||||
"depth": 0.125
|
||||
}
|
||||
Reference in new issue
Block a user