Skip to content

Commit a295afa

Browse files
committed
apply review
1 parent 0140314 commit a295afa

3 files changed

Lines changed: 35 additions & 19 deletions

File tree

src/main/java/com/github/gtexpert/gtbm/integration/gendustry/metatileentities/multiblock/MetaTileEntityMegaApiary.java

Lines changed: 33 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public class MetaTileEntityMegaApiary extends MultiblockWithDisplayBase implemen
9595

9696
private EnergyContainerList energyContainer;
9797

98-
private static IBeekeepingMode mode;
98+
private IBeekeepingMode mode;
9999

100100
public MetaTileEntityMegaApiary(ResourceLocation metaTileEntityId) {
101101
super(metaTileEntityId);
@@ -423,30 +423,46 @@ private void processProducts() {
423423

424424
primary.getProductChances().forEach((stack, f) -> {
425425
float v = (speed + f + baseModifier + baseModifier * getMaxTier()) * applyBonus;
426-
while (v > 1.0F) {
427-
int size = Math.min((int) v, 64);
428-
stack.setCount(size);
429-
products.add(stack);
430-
v -= size;
426+
int amount = (int) v;
427+
if (getWorld().rand.nextFloat() < v - amount) {
428+
amount++;
429+
}
430+
while (amount > 0) {
431+
ItemStack newStack = stack.copy();
432+
int stackSize = Math.min(amount, newStack.getMaxStackSize());
433+
newStack.setCount(stackSize);
434+
products.add(newStack);
435+
amount -= stackSize;
431436
}
432437
});
438+
433439
secondary.getProductChances().forEach((stack, f) -> {
434440
float v = (speed + f + baseModifier + baseModifier * getMaxTier()) * applyBonus;
435-
while (v > 1.0F) {
436-
int size = Math.min((int) v, 64);
437-
stack.setCount(size);
438-
products.add(stack);
439-
v -= size;
441+
int amount = (int) v;
442+
if (getWorld().rand.nextFloat() < v - amount) {
443+
amount++;
444+
}
445+
while (amount > 0) {
446+
ItemStack newStack = stack.copy();
447+
int stackSize = Math.min(amount, newStack.getMaxStackSize());
448+
newStack.setCount(stackSize);
449+
products.add(newStack);
450+
amount -= stackSize;
440451
}
441452
});
442453

443454
primary.getSpecialtyChances().forEach((stack, f) -> {
444455
float v = (speed + f + baseModifier + baseModifier * getMaxTier()) * applyBonus;
445-
while (v > 1.0F) {
446-
int size = Math.min((int) v, 64);
447-
stack.setCount(size);
448-
products.add(stack);
449-
v -= size;
456+
int amount = (int) v;
457+
if (getWorld().rand.nextFloat() < v - amount) {
458+
amount++;
459+
}
460+
while (amount > 0) {
461+
ItemStack newStack = stack.copy();
462+
int stackSize = Math.min(amount, newStack.getMaxStackSize());
463+
newStack.setCount(stackSize);
464+
products.add(newStack);
465+
amount -= stackSize;
450466
}
451467
});
452468
royalJerry -= bonus;
@@ -530,7 +546,7 @@ protected void addDisplayText(List<ITextComponent> textList) {
530546
for (ItemStack stack : merged) {
531547
tl.add(TextComponentUtil.translationWithColor(
532548
TextFormatting.WHITE,
533-
"gtbm.multiblock.maga_apiary.outputs",
549+
"gtbm.multiblock.mega_apiary.outputs",
534550
TextComponentUtil.stringWithColor(
535551
TextFormatting.AQUA,
536552
stack.getDisplayName()),

src/main/resources/assets/gtbm/lang/en_us.lang

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ gtbm.multiblock.mega_apiary.tooltip.11=§eNote§7: When using §aauto-build§7,
5757
gtbm.multiblock.mega_apiary.queens=Queens: %s
5858
gtbm.multiblock.mega_apiary.jerry_body=Royal Jerry: %s
5959
gtbm.multiblock.mega_apiary.jerry_hover=Each Queen increases production by 5%% per Royal Jelly, up to a maximum of +200%%.
60-
gtbm.multiblock.maga_apiary.outputs=%s: §6x%s
60+
gtbm.multiblock.mega_apiary.outputs=%s: §6x%s
6161

6262
# TOP
6363
gtbm.top.mega_apiary.queen=Queen:

src/main/resources/assets/gtbm/lang/ja_jp.lang

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ gtbm.multiblock.mega_apiary.tooltip.11=§e注意§7: §a自動建造§7を用い
5757
gtbm.multiblock.mega_apiary.queens=女王: %s
5858
gtbm.multiblock.mega_apiary.jerry_body=ローヤルゼリー: %s
5959
gtbm.multiblock.mega_apiary.jerry_hover=女王1匹につき、生産量がローヤルゼリー1個ごとに5%%増加する (最大 +200%%)。
60-
gtbm.multiblock.maga_apiary.outputs=%s: §6x%s
60+
gtbm.multiblock.mega_apiary.outputs=%s: §6x%s
6161

6262
# TOP
6363
gtbm.top.mega_apiary.queen=女王:

0 commit comments

Comments
 (0)